Index: Source/devtools/front_end/platform/DOMExtension.js |
diff --git a/Source/devtools/front_end/platform/DOMExtension.js b/Source/devtools/front_end/platform/DOMExtension.js |
index d05900beebcba75503b0278729a234e2445fc911..fb6306a29bec47127d9890b635a22f9862b9da33 100644 |
--- a/Source/devtools/front_end/platform/DOMExtension.js |
+++ b/Source/devtools/front_end/platform/DOMExtension.js |
@@ -275,6 +275,14 @@ Node.prototype.parentNodeOrShadowHost = function() |
} |
/** |
+ * @return {!Window} |
+ */ |
+Node.prototype.window = function() |
+{ |
+ return this.ownerDocument.defaultView; |
+} |
+ |
+/** |
* @param {string} query |
* @return {?Node} |
*/ |
@@ -294,7 +302,7 @@ Element.prototype.removeChildren = function() |
*/ |
Element.prototype.isInsertionCaretInside = function() |
{ |
- var selection = window.getSelection(); |
+ var selection = this.window().getSelection(); |
if (!selection.rangeCount || !selection.isCollapsed) |
return false; |
var selectionRange = selection.getRangeAt(0); |
@@ -588,7 +596,7 @@ Element.prototype.selectionLeftOffset = function() |
{ |
// Calculate selection offset relative to the current element. |
- var selection = window.getSelection(); |
+ var selection = this.window().getSelection(); |
if (!selection.containsNode(this, true)) |
return null; |