Hi again, Rob.
I don't really want to argue over the benefits of attributes versus
expandos, just wanted to outline that they weren't the same thing
although the specs mandate a mapping of specified expandos to their
attribute counterpart for backwards compatibility with DOM 0.
It is also the case that IE never really figured out the difference
between attributes and expandos which has added to the confusion.
In short, attributes are attributes of the HTML element itself, thus
can only be used to store and retrieve strings (HTML cannot
distinguish types of attributes).
Expandos are properties of the DOM node (that is of the JS object
The expando to attribute mapping only works for attributes specified
in HTML 4.01 spec (also note that expando can be of all the primitive
JS types, not only string, and that those are also specified) so it
won't work for custom attributes.
To illustrate this, consider the following in Firefox:
>>> var div = $$('div');
>>> div.setAttribute('value', 'foo');
>>> typeof div.value;
>>> var clone = div.cloneNode(true);
>>> div = $$('div');
>>> div.value = 'foo';
>>> clone = div.cloneNode(true);
>>> typeof clone.value
Of course, the behaviour is different in IE which shares the same
attribute object between cloned nodes(!).
Hope this clarifies the picture a bit.
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to email@example.com
To unsubscribe from this group, send email to
For more options, visit this group at