[webkit-dev] Access to pseudo-class matched CSS rules in Objective-C
franck at lowcoders.net
Mon Oct 27 00:01:07 PDT 2008
For diagnostics purposes, I need to fetch all css properties that come from
rules matching a specific element in the DOM in objective C. Its working
perfectly, except I'd like to know how I can get the matched css rules for
an elemnt with a specific pseudo-class (typically a:hover)...
My code, that's working fine without support for pseudo-classes, looks like
@implementation DOMElement (LWCDExtension)
NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:10
DOMCSSRuleList* cssRulesList = [self.ownerDocument getMatchedCSSRules:self
int rulesLength = cssRulesList.length;
for (int i = 0 ; i < rulesLength ; i++)
DOMCSSRule* aRule = [cssRulesList item:i];
[result addEntriesFromDictionary:[aRule cssProperties]];
Even if I know that pseudo-classes are different from pseudo-elements, and
given that I saw no other method that could potentially do the trick, I
tried something like [self.ownerDocument getMatchedCSSRules:self
pseudoElement:@"hover"]; which didn't work. Is there a way to achieve this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev