Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting CSS string from DIV element?



The only way to get the exact combination of css rules used to display an element is to use getComputedStyle. It won't tell you however when it comes from, but I guess you could walk back yourself the parents to figure that out and look at the style declaration matching the id or class of an element.

On Wednesday, June 1, 2005, at 09:48  AM, Danny Espinoza wrote:

Well, this has been driving me crazy. I've got a DOMHTMLDivElement* referencing a DIV element for which I'd like to get the CSS definition (by id or class) -- just an NSString* with the raw CSS text would do.

I thought it would be as easy as calling DOMElement (DOMElementCSSInlineStyle):style and using DOMCSSStyleDeclaration:cssText and then recursively walk up the parent nodes, looking for inherited CSS properties. However, :style seems to return only inline (?) CSS definitions.

Am I approaching this from the wrong direction? Should I be walking the document's stylesheet instead? Is there an easy way to get the CSS definition text for a given DIV element?

Thanks!
Danny
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webcore-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webcore-dev/email@hidden

This email sent to email@hidden


Benoit

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webcore-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webcore-dev/email@hidden

This email sent to email@hidden
References: 
 >Getting CSS string from DIV element? (From: Danny Espinoza <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.