Maybe this will help : http://www.nabble.com/Selector-:enabled-no-longer-finds-hidden-elements-td21734256s27240.html
--DBJ On Sep 1, 3:00 am, max g <m...@tnug.com> wrote: > Hello all, > > I've been trying to write some code to let users change stylesheets at > will and have run into a bit of confusion as to how each browser > reacts. There seems to be no uniform selector to get a list of > stylesheets that are currently applied or not. > > I'm using a test page with two stylesheets, examples: > > <link type="text/css" rel="stylesheet" href="default.css" > title="default" /> > <link type="text/css" rel="alternate stylesheet" href="theme.css" > title="theme" /> > > I've tried multiple selectors and had somewhat random results from > each: > > Using Firefox 3.5.2, IE 8.0.6001.18702 and Chrome 2.0.172.43. Results > seem to be uniform across jQuery 1.3.2 and the latest nightly. > > Selector: link[rel*=stylesheet] > Result: Works correctly in all browsers. > > Selector: link[rel*=stylesheet]:enabled and link[rel*=stylesheet] > [disabled=false] > Result: > Firefox: Does not find any stylesheets. > Chrome: Does not find any stylesheets. > IE: Finds both stylesheets. > > Selector: li...@rel*=stylesheet]:enabled and li...@rel*=stylesheet] > [disabled=false] > Result: > Firefox: Finds only the default stylesheet, but throws a warning > about @rel. > Chrome: Finds both stylesheets. > IE: Finds both stylesheets. > > Selector: li...@rel*=stylesheet]:disabled and li...@rel*=stylesheet] > [disabled=true] > Result: > Firefox: Finds only the alternate stylesheet, but also throws a > warning about @rel. > Chrome: Does not find any stylesheets. > IE: Does not find any stylesheets. > > I'm assuming Firefox is the only browser that actually reports to the > DOM the disabled attribute on stylesheets, but if so, I'm not sure why > in Firefox you're forced to use @rel to get that information, > especially when using using the selector 'li...@rel*=stylesheet]' > throws a jQuery exception. > > That all being said, $('li...@rel*=style]:enabled').attr('disabled', > true); and $("li...@rel=*style][title='theme']").attr('disabled', > false); seem to work across all browsers to turn stylesheets off and > on, despite the warnings. > > So am I going about this all wrong? Should I be using some other > method to figure out if stylesheets are applied? Or would this be > classified as a bug? > > Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---