Index: include.preload.js |
=================================================================== |
--- a/include.preload.js |
+++ b/include.preload.js |
@@ -114,34 +114,20 @@ |
function init(document) |
{ |
- var canUseShadow = "webkitCreateShadowRoot" in document.documentElement; |
- var fixInlineFrames = false; |
- |
+ // prior to Chrome 37, content scripts don't run on about:blank |
+ // and about:srcdoc. So we have to apply element hiding and collapsing |
+ // from the parent frame, when inline frames are loaded. |
var match = navigator.userAgent.match(/\bChrome\/(\d+)/); |
- if (match) |
- { |
- var chromeVersion = parseInt(match[1]); |
- |
- // the <shadow> element is ignored in Chrome 32 (#309). Also Chrome 31-33 |
- // crashes in some situations on some pages when using shadow DOM (#498). |
- // So we must not use Shadow DOM on those versions of Chrome. |
- if (chromeVersion >= 31 && chromeVersion <= 33) |
- canUseShadow = false; |
- |
- // prior to Chrome 37, content scripts don't run on about:blank |
- // and about:srcdoc. So we have to apply element hiding and collapsing |
- // from the parent frame, when inline frames are loaded. |
- if (chromeVersion < 37) |
- fixInlineFrames = true; |
- } |
+ var fixInlineFrames = match && parseInt(match[1]) < 37); |
// use Shadow DOM if available to don't mess with web pages that |
// rely on the order of their own <style> tags (#309). However we |
// must not create the shadow root in the response callback passed |
// to sendMessage(), otherwise Chrome breaks some websites (#450). |
+ var canUseShadow = "createShadowRoot" in document.documentElement; |
if (canUseShadow) |
{ |
- var shadow = document.documentElement.webkitCreateShadowRoot(); |
+ var shadow = document.documentElement.createShadowRoot(); |
Wladimir Palant
2014/08/29 20:49:51
I apparently missed that in the previous review -
Sebastian Noack
2014/08/29 22:19:29
Done.
|
shadow.appendChild(document.createElement("shadow")); |
} |
@@ -158,18 +144,8 @@ |
{ |
shadow.appendChild(style); |
- try |
- { |
- document.querySelector("::content"); |
- |
- for (var i = 0; i < selectors.length; i++) |
- selectors[i] = "::content " + selectors[i]; |
- } |
- catch (e) |
- { |
- for (var i = 0; i < selectors.length; i++) |
- selectors[i] = "::-webkit-distributed(" + selectors[i] + ")"; |
- } |
+ for (var i = 0; i < selectors.length; i++) |
+ selectors[i] = "::content " + selectors[i]; |
} |
else |
{ |