holtwick / zeed-dom

🌱 Lightweight offline DOM
MIT License
33 stars 5 forks source link

Added any support from css-what, so that the operator '*=' (includes/contains) is allowed. #7

Closed peti446 closed 1 year ago

peti446 commented 1 year ago

I noticed that the any action from css-what was not present so when matching a[href]:not([href *= "javascript:" i]) or iframe[src*=domain.tdl] it would print out a warn of "Unknown CSS selector action" as the any operator was not implemented for the attributes in the parser.

Example:

var zeedDom = require("zeed-dom");

const dom = zeedDom.vdom("<div>Hello World<a href=\"javascript:SomeValues\">Test</a></div>");

const elements = dom.querySelectorAll("a[href]:not([href *= \"javascript:\" i])");

The var elements will contain the <a> element but the expected result should be an empty array []

This PR adds support to the any attribute action to allow the above mention of selector to be used.

holtwick commented 1 year ago

Great, thank you very much!