Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: include.preload.js

Issue 5715983079571456: Issue 309 - Don't use Shadow DOM in Chrome 32 (Closed)
Left Patch Set: Addressed comments Created April 17, 2014, 4:15 p.m.
Right Patch Set: Just check for Chrome 32 Created April 17, 2014, 4:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 10 matching lines...) Expand all
21 function setElemhideCSSRules(selectors) 21 function setElemhideCSSRules(selectors)
22 { 22 {
23 if (selectors.length == 0) 23 if (selectors.length == 0)
24 return; 24 return;
25 25
26 var style = document.createElement("style"); 26 var style = document.createElement("style");
27 style.setAttribute("type", "text/css"); 27 style.setAttribute("type", "text/css");
28 28
29 // Use Shadow DOM if available to don't mess with web pages that 29 // Use Shadow DOM if available to don't mess with web pages that
30 // rely on the order of their own <style> tags. However 30 // rely on the order of their own <style> tags. However
31 // the <shadow> element is broken in Chrome 32.0.1700 (#309) 31 // the <shadow> element is broken in some Chrome 32 builts (#309)
Thomas Greiner 2014/04/22 09:47:04 Nit: Correct "builts" to "builds"
32 var match; 32 if ("webkitCreateShadowRoot" in document.documentElement && !/\bChrome\/32\b/. test(navigator.userAgent))
33 if ("webkitCreateShadowRoot" in document.documentElement && !((match = navigat or.userAgent.match(/\bChrome\/32\.0\.(\d+)\b/)) && parseInt(match[1]) >= 1700))
Thomas Greiner 2014/04/17 17:39:00 Nit: That's an unnecessarily long line. You could
Sebastian Noack 2014/04/17 17:56:45 The reason I did it that way is, is to don't execu
34 { 33 {
35 var shadow = document.documentElement.webkitCreateShadowRoot(); 34 var shadow = document.documentElement.webkitCreateShadowRoot();
36 shadow.appendChild(document.createElement("shadow")); 35 shadow.appendChild(document.createElement("shadow"));
37 shadow.appendChild(style); 36 shadow.appendChild(style);
38 37
39 try 38 try
40 { 39 {
41 document.querySelector("::content"); 40 document.querySelector("::content");
42 41
43 for (var i = 0; i < selectors.length; i++) 42 for (var i = 0; i < selectors.length; i++)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr}); 122 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr});
124 123
125 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); 124 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules);
126 } 125 }
127 126
128 // In Chrome 18 the document might not be initialized yet 127 // In Chrome 18 the document might not be initialized yet
129 if (document.documentElement) 128 if (document.documentElement)
130 init(); 129 init();
131 else 130 else
132 window.setTimeout(init, 0); 131 window.setTimeout(init, 0);
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld