开发者

Will unsupported selectors for CSS work when used inside jQuery?

There are several CSS selectors that a开发者_开发百科re not supported by IE6 example:

> (Child selector)

+ (Selects an element that is a next sibling of another element.)

[attr] selector

:first-child

Does this impact the functioning of jQuery? i.e. if you use eg :

$("div > a").css("","");

Will it cause problems in IE6 or will it work without issues. Basically my question is, in its core does jQuery rely on the browser or does it use its own logic to select DOM elements.

I know everyone hates IE6 and you probably feel it should not be supported, but, I am trying to understand how jQuery actually works under the hood.

Thanks!


jQuery selectors are implemented with the Sizzle Selector engine, which is compatible with:

Fire­fox 2.0+, Inter­net Explorer 6+, Safari 3+, Opera 9+, Chrome 1+

http://www.kevinleary.net/enhancing-css-with-javascript-using-sizzle/


jQuery uses its own selector engine and, whilst sometimes it does map to the browser's selector engine if it's accessible, any selectors not implemented by the browser will result in jQuery applying it's own magic. So yes, it will work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜