Well, I was about to accuse you of a design flaw, but when I followed the examples in the demo page, I discovered the right way, and it works perfectly, even when there's more style tags than one. I still say it's a bit awkward.
And no, they are not chainable, but if you make the rule object an extension of the jQuery object, it will inherit the properties and methods of the jQuery object and so will be chainable. On Jun 17, 11:08 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > > Thanks for the pointer! Say, is there a way this functionality could > > be integrated into jQuery itself? > > Nope. > > > Can I chain like this? > > $.rule returns a Rule object with its own methods. I don't recall if > the methods are chainable, maybe they are. > > > > > Also consider that you may want to distinguish between one window's > > document and another's, as in: > > The rules affects the page once it's added to a style or link. Whose > window is that style/link from, is up to you. > > > These might be considered. Also in the demos it is unclear whether the > > style rule is added to the FIRST tag called "style" or ALL of them, > > since your page contains only one. This makes a difference, because > > the style listed last in the document is the one that gets applied. > > That's why there is a documentation appart from the demo. The 2nd > argument of the constructor is the context (just like with jQuery). > The context can be a selector, a jQuery object, a stylesheet, etc. > > Cheers > -- > Ariel Fleslerhttp://flesler.blogspot.com/