加载期间出现 JQuery 错误“无法执行查询:'*,:x' 不是有效的选择器。”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21661113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JQuery error during load "Failed to execute query: '*,:x' is not a valid selector."
提问by pthalacker
I am trying to debug an application and I can't start because I am getting an error as the browser is loading jquery 2.1.0. The error is on line 1210 of the unminified version
我正在尝试调试应用程序,但无法启动,因为浏览器正在加载 jquery 2.1.0 时出现错误。错误在未缩小版本的第 1210 行
div.querySelectorAll("*,:x");
and I am getting the error in the title.
我收到标题中的错误。
I am using Chrome version 32.
我正在使用 Chrome 版本 32。
回答by MackieeE
I've found this jQuery bug ticketthat seems like what you're experiencing, another one on StackOverflowdescribing the problem and a longer discussion about it on another jQuery bug ticket.
我发现这个jQuery bug ticket看起来就像你遇到的一样,另一个在StackOverflow 上描述了这个问题,并在另一个 jQuery bug ticket 上进行了更长时间的讨论。
Although, it seems like it's nottagged as a bug as it's jQuery's internal error checking/exceptions being thrown.
虽然,它似乎没有被标记为错误,因为它是 jQuery 的内部错误检查/异常被抛出。
As the comment by jQuery team describes:
Resolution set to notabug
Don't break on caught exceptions. We caught it because we expectedit.
分辨率设置为notabug
不要中断捕获的异常。我们抓住了它,因为我们预料到了它。
回答by cweiske
I had this problem on Firefox 57.
我在 Firefox 57 上遇到了这个问题。
The "breaking on exceptions" documentationtells us that "pause button (II)" has threestates. The light purple stateis the one that we want: It shows uncaught exceptions, but ignores caught ones.
在“打破例外”的文件告诉我们,“暂停按钮(II)”有3个州。将浅紫色的状态是我们想要的:它显示捕获的异常,但忽略抓到的。
回答by Hadi.Tabe
if you are using Visual studio codefor debugging, just make the All Exception unchecked in the breakpoints section .
如果您使用Visual Studio 代码进行调试,只需在断点部分取消选中所有异常即可。
回答by kross
Just to add what I found on Chrome/OSX in a particular scenario. I found this using .is(':visible')
只是为了在特定场景中添加我在 Chrome/OSX 上找到的内容。我发现这个使用.is(':visible')
It shows up in the log when it is called from a function executed in a setTimeout() but works just fine.
当从 setTimeout() 中执行的函数调用它时,它会显示在日志中,但工作正常。
Uncaught SyntaxError: Unexpected identifier
Failed to execute 'matches' on 'Element': ':visible' is not a valid selector.
I'm not sure the reason, but I pulled the use of setTimeout
and moved on.
我不确定原因,但我取消了使用setTimeout
并继续前进。
回答by user2900407
I had the same issue and solved it by restarting the browser. It seems to have disappeared.
我遇到了同样的问题并通过重新启动浏览器解决了它。它似乎已经消失了。
回答by Antony Falencikowski
I had the same problem too, drove me nearly nuts. I spent 3 days on this. Check out the following:
我也有同样的问题,快把我逼疯了。我花了3天的时间。查看以下内容:
Body height. Not just the css height, but also physically check the height, I use mozilla firebug to select the body attribute, this highlightes it. If it's above the element, or selection area, it will give the bug. Also css for the specific area to select, and body
身高。不仅仅是css高度,还要物理检查高度,我使用mozilla firebug来选择body属性,这突出了它。如果它位于元素或选择区域上方,则会出现错误。还要选择特定区域的 css 和 body
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
Make sure your user selection is !!NOT!! none.
Hope this helps you out.. I did read some very frustrating posts regarding this issue, and it was not an easy find either, I found it quite by chance.
希望这对你有所帮助.. 我确实阅读了一些关于这个问题的非常令人沮丧的帖子,这也不是一个容易找到的,我是偶然发现的。