Attributes, properties and XHTML

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top