Emerald Editor Discussion
September 22, 2017, 12:06:23 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   Home   Help Search Login Register  
Pages: [1]
Author Topic: CE Javascript syntax  (Read 8306 times)
0 Members and 1 Guest are viewing this topic.
Posts: 4

« on: February 24, 2007, 12:50:09 am »

Hi! Sorry if I'm posting this in the wrong place, I know there's a special CE section but if the syntax files will be forward compatible this should be the place, no?

Anyway, was there ever a big update for the javascript syntax file? The one I have (and the only version I'm able to find on crimsoneditor.com in the syntax section and the forum) is a 2002 version that doesn't know parentNode, firstChild, lastChild etc, doesn't know getElementsByTagName() and thinks getElementsById() is a property rather than a method. Furthermore every single event is written in camelCase instead of lower which means none of them are highlighted if you write working code.

Does nobody ever write javascript anymore or is there something I'm missing?
Site Administrator
Master Jeweller
Posts: 618

« Reply #1 on: February 24, 2007, 11:38:37 am »

Well, I use the one CE comes with as standard, which supports camelCase (I write my own JS in camelCase and it runs fine in IE/Firefox)

You're right, though, it doesn't support later functions of JS. I'll try and put together a more complete syntax before long (anyhow, a more complex one will be required for EE)

JS does seem to be dying out in this multimedia-rich world where high speed connections are common; Flash seems to be more preferable these days.

"Cleverly disguised as a responsible adult!"
Posts: 4

« Reply #2 on: February 24, 2007, 02:38:03 pm »

Uhm... AJAX?

phpBB, Gmail, blogging, all fancy wysiwyg editors.. If anything javascript is becoming more serious these days. Marquees in the status bar seem a thing of the past though Wink

Anyway, camelcase itself isn't a problem, just that javascript doesn't use camelcase for events. So it's onchange, onmouseover etc, and not onChange as listed in the syntax file. Even IE5 gets that right.

Javascript isn't as handily documented as say php so I don't really see a quick and easy way to update this file. I don't have the time to do anything thorough so I'm just adding bits as I go along. Updates so far:

  [KEYWORDS4:GLOBAL]  (# Properties)
I added
  parentNode firstChild lastChild nodeName nodeValue nodeType id
and removed getElementsById, which I listed under
  [KEYWORDS6:GLOBAL]  (# Methods)
together with

The event section loses it's faulty camelcasing to become:

# Event handlers
onabort onblur onchange onclick ondblclick ondragdrop
onerror onfocus onkeydown onkeypress onkeyup
onload onmousedown onmousemove onmouseout onmouseover
onmouseup onmove onreset onresize onselect onsubmit onunload

And that's just about it. I don't know javascript well enough to comment on the rest, but it seems like most DOM related keywords are missing.
Pages: [1]
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.084 seconds with 18 queries.