I came across an oddity with jQuery.merge from a completely different route -- looking through jQuery.support properties. It looks like jQuery.merge is testing for jQuery.support.getAll, but I can't for the life of me find anywhere in the source where jQuery.support.getAll is being defined.
Since jQuery.support.getAll is never true (because it's not defined), comments are always excluded ( if ( elem.nodeType !== 8 ) ). Did jQuery at one point define jQuery.support.getAll? And if so, what was it based on? from core.js line 442 (in github version just pulled this morning): merge: function( first, second ) { // We have to loop this way because IE & Opera overwrite the length // expando of getElementsByTagName var i = 0, elem, pos = first.length; // Also, we need to make sure that the correct elements are being returned // (IE returns comment nodes in a '*' query) if ( !jQuery.support.getAll ) { while ( (elem = second[ i++ ]) != null ) { if ( elem.nodeType !== 8 ) { first[ pos++ ] = elem; } } } else { while ( (elem = second[ i++ ]) != null ) { first[ pos++ ] = elem; } } return first; } --Karl ____________ Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 30, 2009, at 10:31 AM, John Resig wrote: > I think you're right here - I'm not completely convinced that this > distinction still needs to exist. Could you file a ticket? Thanks. > > --John > > > > On Fri, Oct 30, 2009 at 7:47 AM, Robert Katić > <robert.ka...@gmail.com> wrote: >> To be more accurate, >> >> $([]).add( nodeList ) >> >> can not contains comment nodes only on IE. >> This makes it even more ambiguous, with unexpected results. >> Also it seams that the only expected NodeList is from an >> getElementsByTagName.call. >> >> I know that it is not explicitly supported by the API, but even then >> it seams that there are some inconsistent logic. >> >> On Oct 30, 6:28 am, Robert Katić <robert.ka...@gmail.com> wrote: >>> jQuery.merge() is the only function that discards comment nodes (?). >>> >>> This means that >>> >>> $( nodeList ) >>> >>> can contains comment nodes, but >>> >>> $([]).add( nodeList ) >>> >>> can not. >>> >>> Why such different behaviors? >>> Is the jQuery.makeArray() more appropriate to filter comment nodes? >>> Am I missing something here? >> >> -- >> >> 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 >> . >> >> >> > > -- > > 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 > . > > -- 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.