jQuery selectors and sIFR
I'm trying to use jQuery 1.3.1's :not selector with sIFR Ver. 3 Rev. 436.
I've enabled the use of jQuery selector's as per the instructions at the sIFR Wiki, and basic selector's work which leads me to believe that sIFR is using the jQuery selectors. More advanced jQuery selector's are not, though.
To enable jQuery selector's I removed the line in the minified sifr.js that started with var parseSelector=(function()...
and replaced it with var parseSelector = $;
. I also have jQuery being included in the html file before sIFR.
sifr-config.js
var mg = { src: '/static/mg.swf' };
sIFR.activate(mg);
sIFR.replace(mg, {
selector: '#nav a', #This works
...
})
sIFR.replace(mg, {
selector: ':not(p)', #This doesn't work
...
});
My only other option is to hack up the CMS I'm using, so any guidance would be appreciated.
This is the log in response to Pekka.
selector: [object HTMLDocument]
selector: #top-nav a
selector: [object HTMLDocument]
selector:
selector: :contains(Disclaimer)
selector: [object HTMLDocument]
selector:
Unknown pseudo-class or pseudo-element 'contains'.
[Break on this error] undefined
Node cannot be inserted at the specified point in the hierarchy" code: "3
[Break on this error] var sIFR=new function(){var O=this;var E...(<br>)\s*/g,"$1"),primaryLink:k||{}}}};\nsifr.js (line 17)
selector: #top-nav a
selector: [object HTMLDocu开发者_运维知识库ment]
selector:
selector: :contains(Disclaimer)
selector: [object HTMLDocument]
selector:
The fact that basic selectors work doesn't necessarily mean that JQuery's selectors are enabled. The first example (the one that works) is something that any browser can understand without JQUery. My guess is that the activating the use of JQuery selectors didn't work out. You might want to post the code you use to activate it.
:not(p)
looks like a particularly bad replacement to execute, can't you try something that would match fewer elements, especially nested elements?
精彩评论