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

Unified Diff: lib/common.js

Issue 30014561: Issue 7291 - Handle *.foo in qualifySelector() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Feb. 22, 2019, 3:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/common.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/common.js
===================================================================
--- a/lib/common.js
+++ b/lib/common.js
@@ -197,22 +197,20 @@
for (let sub of splitSelector(selector))
{
sub = sub.trim();
qualifiedSelector += ", ";
let index = findTargetSelectorIndex(sub);
- let [, type = "", rest] = /^([a-z][a-z-]*)?(.*)/i.exec(sub.substring(index));
+ let [, type = "", rest] = /^([a-z][a-z-]*)?\*?(.*)/i.exec(sub.substring(index));
// Note that the first group in the regular expression is optional. If it
// doesn't match (e.g. "#foo::nth-child(1)"), type will be an empty string.
- // If `rest` is "*" then it is discarded.
- qualifiedSelector += sub.substring(0, index) + type + qualifier +
- (rest != "*" ? rest : "");
+ qualifiedSelector += sub.substring(0, index) + type + qualifier + rest;
}
// Remove the initial comma and space.
return qualifiedSelector.substring(2);
}
exports.qualifySelector = qualifySelector;
« 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