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

Side by Side Diff: include.preload.js

Issue 4759827771293696: Issue 2528 - Don't parse CSS selectors that have no comma (Closed)
Patch Set: Created May 15, 2015, 11:32 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 function convertSelectorsForShadowDOM(selectors) 145 function convertSelectorsForShadowDOM(selectors)
146 { 146 {
147 var result = []; 147 var result = [];
148 var prefix = "::content "; 148 var prefix = "::content ";
149 149
150 for (var i = 0; i < selectors.length; i++) 150 for (var i = 0; i < selectors.length; i++)
151 { 151 {
152 var selector = selectors[i]; 152 var selector = selectors[i];
153 var start = 0; 153 var start = 0;
154 var sep = "";
155 154
156 for (var j = 0; j < selector.length; j++) 155 if (selector.indexOf(",") != -1)
157 { 156 {
Sebastian Noack 2015/05/15 11:33:49 Changes in this block are only due to indentation.
158 var chr = selector[j]; 157 var sep = "";
159 if (chr == "\\") 158
160 j++; 159 for (var j = 0; j < selector.length; j++)
161 else if (chr == sep)
162 sep = "";
163 else if (sep == "")
164 { 160 {
165 if (chr == '"' || chr == "'") 161 var chr = selector[j];
166 sep = chr; 162 if (chr == "\\")
167 else if (chr == ",") 163 j++;
164 else if (chr == sep)
165 sep = "";
166 else if (sep == "")
168 { 167 {
169 result.push(prefix + selector.substring(start, j)); 168 if (chr == '"' || chr == "'")
170 start = j + 1; 169 sep = chr;
170 else if (chr == ",")
171 {
172 result.push(prefix + selector.substring(start, j));
173 start = j + 1;
174 }
171 } 175 }
172 } 176 }
173 } 177 }
174 178
175 result.push(prefix + selector.substring(start)); 179 result.push(prefix + selector.substring(start));
176 } 180 }
177 181
178 return result; 182 return result;
179 } 183 }
180 184
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 }, true); 294 }, true);
291 295
292 return updateStylesheet; 296 return updateStylesheet;
293 } 297 }
294 298
295 if (document instanceof HTMLDocument) 299 if (document instanceof HTMLDocument)
296 { 300 {
297 checkSitekey(); 301 checkSitekey();
298 window.updateStylesheet = init(document); 302 window.updateStylesheet = init(document);
299 } 303 }
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