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

Side by Side Diff: include.preload.js

Issue 5504296699297792: Issue 1802 - Fix element hiding filters with multiple CSS selectors when using shadow DOM (Closed)
Patch Set: Created Jan. 14, 2015, 11:39 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return; 176 return;
177 177
178 var style = document.createElement("style"); 178 var style = document.createElement("style");
179 style.setAttribute("type", "text/css"); 179 style.setAttribute("type", "text/css");
180 180
181 if (shadow) 181 if (shadow)
182 { 182 {
183 shadow.appendChild(style); 183 shadow.appendChild(style);
184 184
185 for (var i = 0; i < selectors.length; i++) 185 for (var i = 0; i < selectors.length; i++)
186 selectors[i] = "::content " + selectors[i]; 186 selectors[i] = selectors[i].replace(/(\s*)((?:[^,"']|"(?:\\"|[^"])*"|'(? :\\'|[^'])*')+)/g, "$1::content $2");
187 } 187 }
188 else 188 else
189 { 189 {
190 // Try to insert the style into the <head> tag, inserting directly under t he 190 // Try to insert the style into the <head> tag, inserting directly under t he
191 // document root breaks dev tools functionality: 191 // document root breaks dev tools functionality:
192 // http://code.google.com/p/chromium/issues/detail?id=178109 192 // http://code.google.com/p/chromium/issues/detail?id=178109
193 (document.head || document.documentElement).appendChild(style); 193 (document.head || document.documentElement).appendChild(style);
194 } 194 }
195 195
196 var setRules = function() 196 var setRules = function()
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 }, true); 242 }, true);
243 243
244 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); 244 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules);
245 } 245 }
246 246
247 if (document instanceof HTMLDocument) 247 if (document instanceof HTMLDocument)
248 { 248 {
249 checkSitekey(); 249 checkSitekey();
250 init(document); 250 init(document);
251 } 251 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld