diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-04-23 12:17:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-23 12:17:34 +0200 |
commit | bccb9c1708f007ada1ea8c4879db88a587f0a450 (patch) | |
tree | 835dacc8cb3df7b05d4b62f4c551d8ad9f791371 /testing/marionette/element.js | |
parent | 1ea8529cfb0a246d09daf1ec742d063c08cf1899 (diff) | |
parent | d9d3b687b7c892b400e781dd5c57897efd7173aa (diff) | |
download | UXP-bccb9c1708f007ada1ea8c4879db88a587f0a450.tar UXP-bccb9c1708f007ada1ea8c4879db88a587f0a450.tar.gz UXP-bccb9c1708f007ada1ea8c4879db88a587f0a450.tar.lz UXP-bccb9c1708f007ada1ea8c4879db88a587f0a450.tar.xz UXP-bccb9c1708f007ada1ea8c4879db88a587f0a450.zip |
Merge pull request #238 from janekptacijarabaci/js_dom_pointer_events_2
moebius#195: DOM - PointerEvents - improvements (implement pointerup and pointerdown)
Diffstat (limited to 'testing/marionette/element.js')
-rw-r--r-- | testing/marionette/element.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/testing/marionette/element.js b/testing/marionette/element.js index 8e66ee6df..9687fb27d 100644 --- a/testing/marionette/element.js +++ b/testing/marionette/element.js @@ -953,6 +953,12 @@ element.getContainer = function (el) { * pointer-interactable, if it is found somewhere in the * |elementsFromPoint| list at |el|'s in-view centre coordinates. * + * Before running the check, we change |el|'s pointerEvents style property + * to "auto", since elements without pointer events enabled do not turn + * up in the paint tree we get from document.elementsFromPoint. This is + * a specialisation that is only relevant when checking if the element is + * in view. + * * @param {Element} el * Element to check if is in view. * @@ -960,8 +966,14 @@ element.getContainer = function (el) { * True if |el| is inside the viewport, or false otherwise. */ element.isInView = function (el) { - let tree = element.getPointerInteractablePaintTree(el); - return tree.includes(el); + let originalPointerEvents = el.style.pointerEvents; + try { + el.style.pointerEvents = "auto"; + const tree = element.getPointerInteractablePaintTree(el); + return tree.includes(el); + } finally { + el.style.pointerEvents = originalPointerEvents; + } }; /** |