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

Side by Side Diff: lib/common.js

Issue 30012569: Issue 7291 - Don't mangle selectors with a '*' (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Feb. 20, 2019, 8:22 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 | test/common.js » ('j') | 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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 { 199 {
200 sub = sub.trim(); 200 sub = sub.trim();
201 201
202 qualifiedSelector += ", "; 202 qualifiedSelector += ", ";
203 203
204 let index = findTargetSelectorIndex(sub); 204 let index = findTargetSelectorIndex(sub);
205 let [, type = "", rest] = /^([a-z][a-z-]*)?(.*)/i.exec(sub.substr(index)); 205 let [, type = "", rest] = /^([a-z][a-z-]*)?(.*)/i.exec(sub.substr(index));
206 206
207 // Note that the first group in the regular expression is optional. If it 207 // Note that the first group in the regular expression is optional. If it
208 // doesn't match (e.g. "#foo::nth-child(1)"), type will be an empty string. 208 // doesn't match (e.g. "#foo::nth-child(1)"), type will be an empty string.
209 qualifiedSelector += sub.substr(0, index) + type + qualifier + rest; 209 // If `rest` is "*" then it is discarded.
210 qualifiedSelector += sub.substring(0, index) + type + qualifier +
211 (rest != "*" ? rest : "");
210 } 212 }
211 213
212 // Remove the initial comma and space. 214 // Remove the initial comma and space.
213 return qualifiedSelector.substr(2); 215 return qualifiedSelector.substr(2);
214 } 216 }
215 217
216 exports.qualifySelector = qualifySelector; 218 exports.qualifySelector = qualifySelector;
OLDNEW
« no previous file with comments | « no previous file | test/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld