John J. Barton wrote:
Firebug uses:
domUtils.getCSSStyleRules(element)
and fails to get rules for the element if the rule is like:
a:hover {
color:#FF00FF;
text-decoration:none;
}
This is if the element is not in fact in :hover state at the time, right?
However, the rules are found if we "inspect" the element and the mouse
is over the element. It is as if the result of getCSSStyleRules(element)
depends on content state.
It does, indeed. It also depends on the attributes the element has, its
position in the tree, and so forth. These are all no different from
each other, really.
Would it be wise to flip the state bits temporarily around the
getCSSStyleRules() call with
void setContentState ( nsIDOMElement element , PRInt32 state );
and if so are the stage bits documented?
Doing that would sorta work if you only twiddle the ESM-managed bits,
but it would actually change the ESM's state (for example, you can't
remove hover state by unsetting the hover bit this way, as far as I can
tell). In general, the content state stuff in inspector utils is pretty
broken and could use some serious work, imo.
That said, I'm not sure I understand what your precise use case is. Do
you want all rules that might match an element if it were in some other
defined set of states? Something else? nsIInspectorCSSUtils will
likely need to grow more methods to address whatever the use cases are
here (and some of these might need some interesting core changes).
-Boris
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout