[Javascript] List custom element properties in IE5/IE5.5?

liorean liorean at f2o.org
Tue Nov 25 06:42:23 CST 2003


Hakan M. wrote:
> Peter-Paul Koch wrote:
> True, in a sense. I could have looked for the absence of the specified 
> attribute, if IE5 hadn't simply group everything resembling an attribute 
> right on the node. Now I can do a node.getAttribute('firstChild'); and I 
> find myself with a node (In Mozilla, naturally, i found myself with 
> FALSE since there is no attribute named "firstChild" on my node, but a 
> property called "firstChild"). I really hoped that Microsoft would know 
> better than doing their old world-sized array trick.

Even worse, it seems they are doing direct mapping to the respective 
properties and not the array trick. For example, in iew this object is 
perfectly okay:
     {'for':'you can\'t name an identifier a reserved keyword, but you 
can use them for string definitions of hash tables keys, which in 
JavaScript effectively makes them an identifier that you can not 
reference unless you\'re using the key lookup syntax'}

However, iew doesn't support using 'for' or 'class', two of the reserved 
keywords. This seems to be because they are in fact trying to do 
something like converting
     [object DOMElement].setAttribute('for',[string FormFieldID]);
into something like
     [object DOMElement].for=[string FormFieldID];
internally, which of course is a hack that even Microsoft should know 
better than to use. Especially since they would allow it if they had 
instead mapped to
     [object DOMElement]['for']=[string FormFieldID];


>> I think visiting my DOM compatibility tables will help you a lot: 
>> http://www.quirksmode.org/dom/w3c_core.html#attributes . The bug you 
>> report isn't in the table yet, though (which is the main reason I'd 
>> like to see an example script).

> From my testing, I've found the "specified" attribute to work fine i 
> Mozilla. It seems to set specified to true on attributes that have a 
> non-default value specified, may I ask why you claim the support to be 
> minimal? (IE6 does the same thing, with the exception that it treats all 
> custom node properties as "specified attributes" as well, and in my 
> opinion IE6 support is more broken.)

It works pretty okay. Not perfect, but you're not likely to be using it 
thus that you would actually encounter this bug:
<http://bugzilla.mozilla.org/show_bug.cgi?id=199959>

For once, I entirely agree with you. The ie6w implementation is somewhat 
broken. It seems they worked with what they already had, creating hacks 
when required to, instead of adding true support.

However, no browser supports the exact attributes related [DOM2Core] and 
[DOM2HTML] properties, methods and handling as specified in:
[DOM2Core] Attr - 
<http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-637646024>
[DOM2Core] Element - 
<http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614>
[DOM2Core] Node - 
<http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247>
[DOM2HTML] - 
<http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html>
-- 
liorean <mailto:liorean at user.bip.net>

ViewStyles, ViewScripts, ToggleStyles and GraphicsInfo bookmarklets and 
Theme Switcher, Cookies Handler scripts:
<http://liorean.web-graphics.com/>




More information about the Javascript mailing list