D
David Mark
Seems there is some confusion out there (okay a lot of confusion)
regarding XHTML documents, properties and attributes.
http://groups.google.com/group/comp.lang.javascript/msg/6bd058312099893a
The root of the confusion is jQuery (of course.)
Forgetting about that miserable, confusing script for a moment, if you
are really crazy enough to server XHTML (as XHTML), know these
generalizations:
1. XHTML DOM's expose the same properties as HTML DOM's (plus more)
and they work in the same way.
2. The get/set/removeAttribute methods work the same as well
3. Just as get/set/removeAtttribute are not typically needed in HTML,
they are not typically needed for XHTML.
Exceptions involve namespaces other than "html." For example, SVG
elements (in HTML or XHTML DOM's) do *not* work like (X)HTML elements
in that they do not expose all attributes as properties.
A rather absurd "proof" can be seen in the fact that jQuery fouls up
both DOM flavors in virtually identical fashion (same as it fouls up
XML returned in XHR responses.)
Of course, jQuery won't do much of anything right in an XHTML DOM
(most operations will throw exceptions.)
regarding XHTML documents, properties and attributes.
http://groups.google.com/group/comp.lang.javascript/msg/6bd058312099893a
The root of the confusion is jQuery (of course.)
Forgetting about that miserable, confusing script for a moment, if you
are really crazy enough to server XHTML (as XHTML), know these
generalizations:
1. XHTML DOM's expose the same properties as HTML DOM's (plus more)
and they work in the same way.
2. The get/set/removeAttribute methods work the same as well
3. Just as get/set/removeAtttribute are not typically needed in HTML,
they are not typically needed for XHTML.
Exceptions involve namespaces other than "html." For example, SVG
elements (in HTML or XHTML DOM's) do *not* work like (X)HTML elements
in that they do not expose all attributes as properties.
A rather absurd "proof" can be seen in the fact that jQuery fouls up
both DOM flavors in virtually identical fashion (same as it fouls up
XML returned in XHR responses.)
Of course, jQuery won't do much of anything right in an XHTML DOM
(most operations will throw exceptions.)