g-plane / typed-query-selector

Better typed `querySelector` and `querySelectorAll`.
https://www.npmjs.com/package/typed-query-selector
MIT License
729 stars 11 forks source link

It doesn't seem to support all attribute selector contents #3

Closed fregante closed 3 years ago

fregante commented 3 years ago

I'm looking to use these types in my querySelector wrapper module but in my tests it seems that the + character is not supported in attributes:

'link[type="application/json"]' => HTMLLinkElement
'link[type="application/atom+xml"]' => Element

I wonder what other characters can create problems

g-plane commented 3 years ago

The reason is + is a selector combinator, then it treats xml"] as unparsed string.

fregante commented 3 years ago

Should it be escaped? When quoted, the selector works