aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2014-12-15 07:43:42 +0000
committerStephen Blott2014-12-15 07:43:42 +0000
commit9e00ffdc1bedb1860938db60fe44af7fe9a1c9f8 (patch)
tree40626f1d5653653ae749e5ef34e7bbe582fee3bf /lib
parent0c75b89acbea356e5c2993fd016e9ccc67ef034b (diff)
parent4837af619b39e92b0eacd082867ba6b139875ba5 (diff)
downloadvimium-9e00ffdc1bedb1860938db60fe44af7fe9a1c9f8.tar.bz2
Merge branch 'fullscreen-children-linkhints' of https://github.com/mrmr1993/vimium into mrmr1993-fullscreen-children-linkhints
Diffstat (limited to 'lib')
-rw-r--r--lib/dom_utils.coffee10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index dfaa5d5f..c2bfad4c 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -33,13 +33,19 @@ DomUtils =
makeXPath: (elementArray) ->
xpath = []
for element in elementArray
- xpath.push("//" + element, "//xhtml:" + element)
+ xpath.push(".//" + element, ".//xhtml:" + element)
xpath.join(" | ")
+ # 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, document.documentElement, namespaceResolver, resultType, null)
+ document.evaluate(xpath, contextNode, namespaceResolver, resultType, null)
#
# Returns the first visible clientRect of an element if it exists. Otherwise it returns null.