jQuery 1.6.2 升级导致元选择器出现问题
这在 1.4 中工作得很好。
var ogimagetag = $('meta[property=og:image]').attr('content');
给我
未捕获的语法错误,无法识别的表达式:[property=og:image]
该错误似乎很严重。
Sizzle.error = function( msg ) {
throw "Syntax error, unrecognized expression: " + msg;
};
jquery-1.6.2.js:4057 Uncaught Syntax error, unrecognized expression: [property=og:image]
有人知道我如何选择 og:image meta 的内容而不导致错误?或者这是一个发出嘶嘶声的错误?
This worked fine with 1.4.
var ogimagetag = $('meta[property=og:image]').attr('content');
gives me
Uncaught Syntax error, unrecognized expression: [property=og:image]
The error seems to be sizzle.
Sizzle.error = function( msg ) {
throw "Syntax error, unrecognized expression: " + msg;
};
jquery-1.6.2.js:4057 Uncaught Syntax error, unrecognized expression: [property=og:image]
Anyone know how I can select the content of og:image meta without causing an error? Or is this a bug with sizzle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将值放在引号中。我认为
:
令人困惑。引用该值可以解决此问题。示例: http://jsfiddle.net/n7zse/
Put the value in quotes. I think it's the
:
that's confusing sizzle. Quoting the value fixes this.Example: http://jsfiddle.net/n7zse/