Apparently missing) fixed in jQuery: not (.class on everyone except Safari?

I had a jQuery syntax error in my Script, but only Safari throws an exception.

$("#id:not(.class").length

: was not closed). In Safari, the length is 0, in all other browsers this was the correct value if the error did not exist. Is it possible that Chrome, Firefox, Opera and Internet Explorer fix these errors on the fly?

In addition, it does not seem to be inherent in jQuery, because even inline calls querySelectorrestore syntax errors in the selection letter:

document.querySelector('[href^="h'  ) ===
document.querySelector('[href^="h"]'); // true in non-Safari

document.querySelector(':not([X="Y'   ) ===
document.querySelector(':not([X="Y"])'); // true in non-Safari

The error raised in Safari reads SYNTAX_ERR: DOM Exception 12.

+4
source share
2 answers

- , , , . Chrome "" , , ; , , .

, . , IE, , . , :)

, , . , JavaScipt.

+1

  $("#id:not('.class')").length

 $("#id:not(.class").length
-1

Source: https://habr.com/ru/post/1538579/


All Articles