This has been constantly requested for the core, that css() return a style object. It's a simple and useful addition, nice one.
On Jun 8, 7:55 am, peol <peola...@gmail.com> wrote: > Hey guys, been following this group for a while and thought I'd share > my two cents with the community. > > I've recently developed a small plugin (~600 byte minified) that will > let you grab CSS for an element based upon another element in the same > scope/hierarchy in the DOM. > > I'd like to see this kind of functionality in core, where a user could > just simply call .css() to grab a elements CSS. Consider this: > > CSS (pseudo selectors): > div:first { > font-size: 25px; > background-color: #C0C0C0; > > } > > div:last { > font-size: 12px; > background-color: #FF0000; > > } > > // This will contain everything that is unique for div:first compared > to div:last > var css = $('div:first').getCSS('div:last'); > > // This will return an object containing all CSS unique for div:first > compared to a 'normal' div > var css = $('div:first').getCSS(); > > // Consider that this one contains some 100+ elements > $('#someSelector div').css(css); > > You can read (and see test cases) > here:http://andreehansson.se/code/computedstyle/ > > In my initial testing, this method will be ~2-3 times faster then > grabbing ALL css properties for the element and injecting it to the > other ones. > > Whaddayathink? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---