Bug 1596792 - Remove useless usage of getBindingParent in devtools. r=jdescottes
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 18 Nov 2019 10:31:32 +0000
changeset 502397 e127df386eaf5caf0db224afac2052d906f2b8d8
parent 502396 84919209f983e0c7d71f12a5a5cd4f4edc57675e
child 502398 a67caf145931c59a6471afd2dc0f7bb68f2fe6f4
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1596792
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1596792 - Remove useless usage of getBindingParent in devtools. r=jdescottes There's a nice Node.isConnected that does what you want. Differential Revision: https://phabricator.services.mozilla.com/D53213
devtools/server/actors/highlighters/utils/markup.js
--- a/devtools/server/actors/highlighters/utils/markup.js
+++ b/devtools/server/actors/highlighters/utils/markup.js
@@ -4,17 +4,16 @@
 
 "use strict";
 
 const { Cu, Cr } = require("chrome");
 const {
   getCurrentZoom,
   getWindowDimensions,
   getViewportDimensions,
-  getRootBindingParent,
   loadSheet,
 } = require("devtools/shared/layout/utils");
 const EventEmitter = require("devtools/shared/event-emitter");
 const InspectorUtils = require("InspectorUtils");
 
 const lazyContainer = {};
 
 loader.lazyRequireGetter(
@@ -132,20 +131,18 @@ function isNodeValid(node, nodeType = No
   }
 
   // Is its document accessible?
   const doc = node.ownerDocument;
   if (!doc || !doc.defaultView) {
     return false;
   }
 
-  // Is the node connected to the document? Using getBindingParent adds
-  // support for anonymous elements generated by a node in the document.
-  const bindingParent = getRootBindingParent(node);
-  if (!doc.documentElement.contains(bindingParent)) {
+  // Is the node connected to the document?
+  if (!node.isConnected) {
     return false;
   }
 
   return true;
 }
 exports.isNodeValid = isNodeValid;
 
 /**