Ok, this is what exactly I wanted to mention but did not, in order not to make a moot point... Indeed, dom tree has 4 singletons (not one) :
html, head, document and body + window (aka host) which is not a dom node "per se". Whatever the "users are expecting". jQuery "holds" only one: a document. The whole issue that is arising (and will arise more and more) is coming from the fact that a number of "$ scouts" is climbing the dom tree without much care for each other (not to mention the tree). As more and more different jquery instances and more and more jquery plugins are present, the "web client" situation is edging towards a very complicated one. Especially as "single page ajax app" is "en vogue". W3C comitee is very well aware of this, since 1999. This is why MutationEvents have been introduced. When and if this will become an real issue, is for you (John) to decide. I am just trying to help. I hope. --DBJ PS: This issue is waiting "in the ambush" for all the other javascript frameworks. Maybe this framework, is well positioned to start solving it now? On Dec 21, 4:40 pm, John Resig <jere...@gmail.com> wrote: > > $() > > $("html") > > $( document ) > > All three of those things point to different things so it doesn't make > sense to have it be a "singleton". > > The first gives you an empty set, the second is a set containing the > document element, the third is a set containing the document. > > The only case we could (presumably) optimize for would be jQuery( > document ) but in attempting to do that a while back (back when > rootQuery was introduced) it proved to have a number of unforeseen > consequences (namely that users expect the results being returning > from jQuery to be unique). > > As it is, we've made the one optimization that we can make (speeding > up jQuery("someselector") by not having to call jQuery(document) every > time) and I think that's fine. > > --John -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.