b-fuze / deno-dom

Browser DOM & HTML parser in Deno
https://jsr.io/@b-fuze/deno-dom
MIT License
423 stars 47 forks source link

Add support for :has() pseudo-selector #155

Open PastelStoic opened 12 months ago

PastelStoic commented 12 months ago

Here's an example that functions in a browser DOM:

const text = `
<div>
  <li>
  <p class='example'>text</p>
  </li>
  <li>
  <p>text</p>
  </li>
</div>`
const parser = new DOMParser().parseFromString(text, "text/html")!;
const itemWithExample= parser.querySelector("li:has(.example)");
assert(itemWithExample);
Siltaar commented 4 months ago

Looks like a duplicate of #139