Re: [css-regions] Possible change to the Region interface

> > It seems odd that I can get from an Element to a PseudoElement, but
> > there's no way to get back from the PseudoElement to the Element (or
> > find
> > out which PseudoElement it is). Am I missing something?
>
> It hasn't beed added yet because none of these points from the end of the
> email below have been met yet, AFAIK:
>
> http://lists.w3.org/Archives/Public/www-style/2013Aug/0453.html

The quoted mail was about CSSStyleDeclaration.parentElement, not 
PseudoElement.parentElement (though the property name and behavior is the 
same; those are two different things).



On a related note, I think it could make sense to have PseudoElement inherit 
from the Node or Element interface, or at least inspire from them. That 
would give you "parentElement", "nodeName", "ownerDocument" and such things; 
even if also arguably a bunch of methods that will have to throw as not 
implemented if we directly make PseudoElement inherit from Node. 
PseudoElements would not be visible in the DOM themselves but if you get one 
via an API, you can have their parentElement like if they were a child node 
of the element.


That being said, maybe the DOM API isn't what we really need here. Maybe 
what we need is something that exposes something like the StyledElement 
interface of webkit. I think this approach is good for CSS Region fragments, 
too. Instead of doing "region.getComputedRegionStyle(contentElement)" you 
could get "contentElement.getFragmentsIn(region)" which would return a list 
StyledElement objects whose parent element would be "contentElement" and 
which would be included in "region.getFragments()[0].children". This would 
actually expose anonymous boxes and allow to explore the layout tree. 

Received on Thursday, 3 October 2013 11:19:45 UTC