当用querySelector()或querySelectorAll()查找类似name="2nd_btn"的元素时,FF,chrome和IE8都会报错。
Error: uncaught exception: [Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: ".../test/qsa.html Line: 18"]
This is a sample warning
This is a sample error
This is another sample warning
This is another sample error
输出:2
var b = document.querySelector("[id=3err]")
alert(b.tagName)//报错
var c = document.querySelectorAll("[name=1err]")
alert(c.length)//报错
script>