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

Side by Side Diff: include.preload.js

Issue 5663214012465152: Issue 2467 - Ingore inner quotes when parsing CSS selectors (Closed)
Patch Set: Created May 7, 2015, 3:25 p.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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = ""; 154 var sep = "";
155 155
156 for (var j = 0; j < selector.length; j++) 156 for (var j = 0; j < selector.length; j++)
Thomas Greiner 2015/05/07 17:42:58 This loop is only necessary if there's a `,` in th
Sebastian Noack 2015/05/07 18:59:40 Not a bad idea, of course assuming that it makes a
Sebastian Noack 2015/05/07 19:17:22 So I tried following: function convertSelectorsFo
Thomas Greiner 2015/05/08 17:03:25 I'd recommend using `window.performance.now()` for
Sebastian Noack 2015/05/08 17:21:28 I'm not sure whether I can confirm your benchmark.
Sebastian Noack 2015/05/15 11:35:21 There you go: http://codereview.adblockplus.org/47
157 { 157 {
158 var chr = selector[j]; 158 var chr = selector[j];
159 if (chr == "\\") 159 if (chr == "\\")
160 j++; 160 j++;
161 else if (chr == sep) 161 else if (chr == sep)
162 sep = ""; 162 sep = "";
163 else if (chr == '"' || chr == "'") 163 else if (sep == "")
164 sep = chr;
165 else if (chr == "," && sep == "")
166 { 164 {
167 result.push(prefix + selector.substring(start, j)); 165 if (chr == '"' || chr == "'")
168 start = j + 1; 166 sep = chr;
167 else if (chr == ",")
168 {
169 result.push(prefix + selector.substring(start, j));
170 start = j + 1;
171 }
169 } 172 }
170 } 173 }
171 174
172 result.push(prefix + selector.substring(start)); 175 result.push(prefix + selector.substring(start));
173 } 176 }
174 177
175 return result; 178 return result;
176 } 179 }
177 180
178 function init(document) 181 function init(document)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 }, true); 290 }, true);
288 291
289 return updateStylesheet; 292 return updateStylesheet;
290 } 293 }
291 294
292 if (document instanceof HTMLDocument) 295 if (document instanceof HTMLDocument)
293 { 296 {
294 checkSitekey(); 297 checkSitekey();
295 window.updateStylesheet = init(document); 298 window.updateStylesheet = init(document);
296 } 299 }
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