开发者

Problems upgrading jquery 1.4.2 to 1.5.1

I'm trying to upgrade from jquery 1.4.2 to 1.5.1 and I'm getting the following error:

Uncau开发者_如何学编程ght Syntax error, unrecognized expression: [rel*=address:]

I can't figure out what it's related to. Any ideas?


attribute selector needs to be enclosed by quote "

i.e. [rel*="address:"]


I think you have to escape the colon in the attribute:

If you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes: \. For example, if you have an element with id="foo.bar", you can use the selector $("#foo\.bar"). http://api.jquery.com/category/selectors/

Earlier versions of jquery seemed to be more forgiving


It may be that jQuery 1.4.2 just so happened to accept your invalid expression, but the correct expression is:

[rel*="address:"]

This is why it's very important that you read the documentation and use the correct syntax, regardless of whether or not your broken code "appears to work".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜