Re: [w3c/pointerlock] Update for Shadow DOM (#4)

> +      <dl title='partial interface DocumentOrShadowRoot' class='idl'>
> +         <dt>readonly attribute Element? pointerLockElement</dt>
> +         <dd>
> +           <dfn title="pointerLockElement"></dfn>
> +
> +           <p>While the pointer is locked, and
> +    the element set as the target for mouse events is a
> +           <a href="https://dom.spec.whatwg.org/#concept-shadow-including-descendant">shadow-including descendant</a> of the
> +           <a href="http://dom.spec.whatwg.org/#context-object">context object</a>,
> +    returns the result of the
> +           <a href="https://https://w3c.github.io/webcomponents/spec/shadow/#dfn-retargeting-algorithm">retargeting algorithm</a>
> +           with the
> +           <a href="http://dom.spec.whatwg.org/#context-object">context object</a> and
> +    the element as input, if the result and the
> +           <a href="http://dom.spec.whatwg.org/#context-object">context object</a> are in the
> +           same tree, otherwise returns null.</p>

Will add an example.

The situation happens e.g. when 2 shadow hosts exist in the same tree (thus 2 shadow roots, `root1` and `root2`),
and the when pointer locked element is under `root1`.
`root1.pointerLockElement` returns the exact element, `document.pointerLockedElement` returns `root`'s host.
For `root2.pointerLockElement`, if we apply the retargeting algorithm with `root2` and the target, the result will
be `root1`'s host, and is *visible* from `root2`, but not in or descendant of `root2`'s tree.  Therefore
`root2.pointerLockElement` returns null.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/pointerlock/pull/4/files/3ea549a5dac7b193f45d115af4f404f659cf0090#r70028294

Received on Friday, 8 July 2016 06:00:02 UTC