From 6600a27c338ab8f75f73deae8391661fcb7d306f Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 28 Aug 2015 10:56:05 -0400 Subject: [PATCH] https://github.com/chrisaljoudi/uBlock/issues/1528: apply fix to element picker --- src/js/scriptlets/element-picker.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/js/scriptlets/element-picker.js b/src/js/scriptlets/element-picker.js index 2a980afa3..afea44382 100644 --- a/src/js/scriptlets/element-picker.js +++ b/src/js/scriptlets/element-picker.js @@ -19,7 +19,7 @@ Home: https://github.com/gorhill/uBlock */ -/* global self, vAPI, CSS */ +/* global self, vAPI, CSS, HTMLDocument, XMLDocument */ /******************************************************************************/ /******************************************************************************/ @@ -120,6 +120,20 @@ /******************************************************************************/ +// https://github.com/gorhill/uBlock/issues/464 +if ( document instanceof HTMLDocument === false ) { + // https://github.com/chrisaljoudi/uBlock/issues/1528 + // A XMLDocument can be a valid HTML document. + if ( + document instanceof XMLDocument === false || + document.createElement('div') instanceof HTMLDivElement === false + ) { + return; + } +} + +/******************************************************************************/ + // don't run in frames if ( window.top !== window ) { return;