html = '<h1>foo</h1><p>bar</p>';
virtual_dom = $(html);
console.log(virtual_dom);
// logs a data structure recognizable as a DOM with the h1 and p from the string
Does jQuery provide a way to remove paragraphs from virtual_dom, such that console.log(virtual_dom) will log a DOM with only a h1 tag, like $('p').remove() but affecting virtual_dom instead of the actual document rendered by the browser?
Use
.filter(), for example:This will exclude all
paragraphs from yourhtml.DEMO.