Closed seckardt closed 3 months ago
Parsing a selector of the following kind:
[attribute="value"]:has(...)
fails with a SyntaxError like this:
SyntaxError
SyntaxError: missing ) after argument list
The error can be tracked down to this piece of code in nwsapi .js:
nwsapi .js
Function('s', F_INIT + '{' + head + vars + ';' + loop + 'return r;}')(Snapshot);
which ultimately generates code like this:
function(){"use strict";return function Resolver(c,f,x,r){var e,n,o;e=c;if(s.match("[class="div2"]",e) && e.querySelector("div")){if(((/^div2$/).test(e.getAttribute&&e.getAttribute("class"))==true)){r=true;}}return r;}}
which contains the problematic piece s.match("[class="div2"]",e) including the unescaped "[class="div2"]".
s.match("[class="div2"]",e)
"[class="div2"]"
Seems like this issue was even brought up ealier by @Talor-A in https://github.com/dperini/nwsapi/issues/92#issuecomment-1861815928_, where the PR #92 otherwise seems to be unrelated.
Fix merged
Parsing a selector of the following kind:
fails with a
SyntaxError
like this:The error can be tracked down to this piece of code in
nwsapi .js
:which ultimately generates code like this:
which contains the problematic piece
s.match("[class="div2"]",e)
including the unescaped"[class="div2"]"
.Seems like this issue was even brought up ealier by @Talor-A in https://github.com/dperini/nwsapi/issues/92#issuecomment-1861815928_, where the PR #92 otherwise seems to be unrelated.