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

Peter-Paul Koch gassinaumasis at hotmail.com
Mon Nov 24 18:00:00 CST 2003



>Imagine the following tag, with the custom property:
><div id="myid" mycustom="thisvalue" width="30"> hello </div>
>
>Now, I want a LIST of the attributes DEFINED ON THE TAG, including custom 
>attributes. I do not know any of the possible custom attributes up front. 
>In Mozilla and Internet Explorer 6, the following function works:

>In Internet Explorer 5.5, however, the custom properties exist in the 
>elements "all"-collection (element[PROPNAME]), but only as 
>element[PROPNAME] = VALUE, where PROPNAME is just a standard string 
>identifyer. Hence, there's no way for me to tell if the element[PROPNAME] 
>is a property, a custom property or if it's even defined on the tag and not 
>by IE (like element['onmouseover'], element['class'] et cetera).
>
>When I try a (slightly more 'friendly') version of the above script in 
>IE5/IE5.5 the "specified" attribute, among other things, returns 'false' 
>even if the property was indeed set on the element. IE5/IE5.5 can SOMETIMES 
>find ONE (of many) custom attributes, but in nine times out of ten, the 
>browser crashes badly after finding that first one.

Interesting. I think you've stumbled on a new bug. Could you please post a 
page with the script that crashes IE5? I'd like to have a look at the 
script.

>Anybody ever did anything similar?
>element.getAttributesOnElement would be a nice method. ;)

If specified doesn't work, I'm afraid your script is not going to work in 
IE5.

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).

-------------------------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.quirksmode.org/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
------------------------------------------------------------------

_________________________________________________________________
Hotmail en Messenger on the move 
http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/




More information about the Javascript mailing list