W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2016

Re: [csswg-drafts] HTMLElement.prototype.offsetParent leaks a node inside a shadow tree

From: Ryosuke Niwa via GitHub <sysbot+gh@w3.org>
Date: Wed, 14 Dec 2016 00:52:33 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-266909734-1481676751-sysbot+gh@w3.org>
@TakayoshiKochi : I’m proposing the step 2 of 
[offsetParent](https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent)
 from

> If ancestor is not closed-shadow-hidden from the element and 
satisfies at least one of the following, terminate this algorithm and 
return ancestor.

to

> If ancestor’s root is a shadow-including ancestor of the element and
 satisfies at least one of the following, terminate this algorithm and
 return ancestor.

and update offsetTop and offsetLeft accordingly.

> @rniwa when I’m trying to traverse over offsetParents, which are the
 elements defining containing blocks for absolutely-positioned 
descendants, I want to discover all the nodes affecting position. I am
 deliberately trying to walk up the layout tree.

That breaks the encapsulation shadow DOM provides.  If anything, that 
functionality should be provided with a new property like 
`composedOffsetParent`.  We can discuss whether we should be adding 
such a property separately, but we can’t just let an existing DOM / 
CSS OM property expose a node inside a shadow tree.

-- 
GitHub Notification of comment by rniwa
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/159#issuecomment-266909734 
using your GitHub account
Received on Wednesday, 14 December 2016 00:52:39 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:06 UTC