diff options
| author | mrmr1993 | 2014-12-15 00:07:35 +0000 |
|---|---|---|
| committer | mrmr1993 | 2014-12-15 00:07:35 +0000 |
| commit | 4837af619b39e92b0eacd082867ba6b139875ba5 (patch) | |
| tree | a99ddb7015193f85ab32e8a788f102205ee4b540 /lib | |
| parent | dcc7e1ff5ae28b700e12ecf75d403001fc9c2152 (diff) | |
| download | vimium-4837af619b39e92b0eacd082867ba6b139875ba5.tar.bz2 | |
Restrict evaluateXPath to the fullscreen element when fullscreen
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 5f316c08..95427903 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -36,7 +36,13 @@ DomUtils = xpath.push(".//" + element, ".//xhtml:" + element) xpath.join(" | ") - evaluateXPath: (xpath, resultType, contextNode = document.documentElement) -> + # Evaluates an XPath on the whole document, or on the contents of the fullscreen element if an element is + # fullscreen. + evaluateXPath: (xpath, resultType) -> + contextNode = if document.webkitIsFullScreen + document.webkitFullscreenElement + else + document.documentElement namespaceResolver = (namespace) -> if (namespace == "xhtml") then "http://www.w3.org/1999/xhtml" else null document.evaluate(xpath, contextNode, namespaceResolver, resultType, null) |
