jQuery is made to manipulate elements, not nodes. Only one or two
methods even allow you to get them into jQuery collections, and nearly
all subsequent operations (e.g.
.filter()
) will throw them out of the collection. The docs say
http://api.jquery.com/jQuery/
Please
note that although you can pass text nodes and comment nodes into a
jQuery collection this way, most operations don't support them.
The few that do will have an explicit note on their API
documentation page.
Text and comment
nodes
are not
elements
and DOM implementations don't support the same sets of operations
on them.
If you think it would be an improvement to support all these use
cases, see if you can put together a set of changes. Be sure that it
works on all the supported browsers, which even for the 2.x branch
goes all the way back to Android 2.3.