javascript - Jquery and Get traversing API -
javascript - Jquery and Get traversing API -
is there simple way node list (including given node) matched query jquery?
i thought using .find method following:
var getnodes = function(dom, query){ var nodes = $(dom).find(query || '*'); nodes.splice(0,0,dom); homecoming nodes; }
olivier
if want search within set made of dom
, contents elements matching query, can do
$(dom).find(query).add($(dom).filter(query))
or
$(dom).find(query).addback().filter(query);
a simpler 1 (but slower if there many children) be
$(dom).find('*').addback().filter(query);
javascript jquery splice
Comments
Post a Comment