Search Stylesheet Selectors with MooTools

You should already know that MooTools has Fx.Morph, that allows you to animate multiple css properties on an element and you can also pass it a selector string so you don\’t have to type out all of the properties.

Well, you can also pull these properties by using an undocumented method in MooTools, as I just learned from Mark Obcena. How? It\’s very simple as you will see.

Code

var selector_rules = new Fx.CSS().search(\'.some_class\');
// returns an object with camelCase key\'s

See, isn\’t that simple? Keep in mind that this doesn\’t give you every single property. In my tests of running this code with Firebug on GameSpot.com, font-family and overflow properties were missing in the returned object when it clearly shows up in Firebug\’s CSS panel.

Leave a Reply

Your email address will not be published. Required fields are marked *