Search code examples
javascriptjquerysizzle

Select child element of cached node using Sizzle


Anybody familiar with Sizzle? Is there support for selecting children of cached DOM nodes? Like jQuery:

var body = jQuery('body');
var div = jQuery('#mydiv',body);

10x for your kind help, BR


Solution

  • Use direct child selector with context:

    Sizzle( "> *", body);
    

    In fact, I directly copypasted Sizzle source code and this worked, so I don't understand the downvotes:

    var body = Sizzle("body");
    var childrenOfBody = Sizzle( "> *", body[0]);