Re: computedStyle of cloneNode

On Tue, May 3, 2016 at 9:13 PM Rune Lillesveen <> wrote:

> On Tue, May 3, 2016 at 12:57 PM, Shane Stephens <> wrote:
> > I'm not sure it makes sense to match rules on out-of-document elements at
> > all. Some rules (like nth-child) are conditional and may match once the
> > element is inserted (plus there's inheritance), so any computed style is
> not
> > guaranteed to be correct. I'd rather specify that elements must be in the
> > tree to match rules, and either provide no style or provide initial
> values
> > only for out-of-document elements.
> I didn't understand what you meant by :nth-child and the computed
> style not being correct. :nth-child would never match detached
> elements which do not have a parent element, the same way document
> root elements never match :nth-child. Descendants would match as
> usual.

Right, that's what I mean. The computed style of the detached element can't
be "correct" in general as it might be modified by context when inserted
into the document. Given that, what would a computed style on a detached
element actually represent, and what use cases would there be to have one?


> > I don't think there are any compatibility issues for open web content as
> our
> > behavior here is quite divergent.
> No, probably not. I don't know if there are any obvious use cases here.
> --
> Rune Lillesveen

Received on Tuesday, 3 May 2016 21:50:07 UTC