[webkit-dev] Access to pseudo-class matched CSS rules in Objective-C
Franck Stauffer
franck at lowcoders.net
Mon Oct 27 00:01:07 PDT 2008
Hello,
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
this:
@implementation DOMElement (LWCDExtension)
[...]
-(NSDictionary*) cssProperties
{
NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:10
];
DOMCSSRuleList* cssRulesList = [self.ownerDocument getMatchedCSSRules:self
pseudoElement:@""];
int rulesLength = cssRulesList.length;
for (int i = 0 ; i < rulesLength ; i++)
{
DOMCSSRule* aRule = [cssRulesList item:i];
[result addEntriesFromDictionary:[aRule cssProperties]];
}
return result;
}
[...]
@end
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?
Thanks,
Franck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20081027/7821c51f/attachment.html>
More information about the webkit-dev
mailing list