SYNTAX_ERR: DOM Exception 12 - Hmmm

﹥>﹥吖頭↗ 提交于 2019-11-28 21:03:22

You are using illegal id-attributes(illegal before HTML5) inside the document, e.g. 2-slide . Fix them.

To explain: to solve the known misbehaviour of element.querySelectorAll() the selector .slide will be internally rewritten(by using the id of the element). This will result in something like that:

#2-slide .moreselectors

...and forces the error, because an ID may not start with a Number.

See the fiddle: http://jsfiddle.net/doktormolle/FGWhk/

If you are coming here after searching for this error in HTML5 rocks slides:

For some reason they remove the class 'to-build' with the following:

toBuild[0].classList.remove('to-build', '');

That breaks all slide decks the use build, even the Google demo right now is broken

Just change line 220 of default.js to

toBuild[0].classList.remove('to-build');

all is well!

In my case it was using self.postMessage(e.data); in the main thread while using web workers.

I know it's not related to the OP's issue, but it's an odd error so I'm leaving this here in hope it helps others.

Same problem to me but in my case a try to get elements from their attribute

document.querySelectorAll('input[name="path"]')

and SYNTAX_ERR: DOM Exception 12 occurred only on Safari. So i've change it to get the element directly from class and now work fine.

You can escape the quotes like in applescript then no issue on safari

do JavaScript "document.querySelector('span[" & attrName & "=\"" & attrValue & "\"]').click();"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!