code review: no need to capture in regex

This commit is contained in:
gorhill 2015-11-05 09:19:45 -05:00
parent 5464dc2b9e
commit c99b61da96

View file

@ -728,10 +728,10 @@ FilterContainer.prototype.compileGenericSelector = function(parsed, out) {
// Single-CSS rule: no need to test for whether the selector
// is valid, the regex took care of this. Most generic selector falls
// into that category.
if ( matches[1] === selector ) {
if ( matches[0] === selector ) {
out.push(
'c\vlg\v' +
matches[1]
matches[0]
);
return;
}
@ -739,7 +739,7 @@ FilterContainer.prototype.compileGenericSelector = function(parsed, out) {
if ( this.isValidSelector(selector) ) {
out.push(
'c\vlg+\v' +
matches[1] + '\v' +
matches[0] + '\v' +
selector
);
}
@ -774,7 +774,7 @@ FilterContainer.prototype.compileGenericSelector = function(parsed, out) {
};
FilterContainer.prototype.reClassOrIdSelector = /^([#.][\w-]+)$/;
FilterContainer.prototype.rePlainSelector = /^([#.][\w-]+)/;
FilterContainer.prototype.rePlainSelector = /^[#.][\w-]+/;
FilterContainer.prototype.reHighLow = /^[a-z]*\[(?:alt|title)="[^"]+"\]$/;
FilterContainer.prototype.reHighMedium = /^\[href\^="https?:\/\/([^"]{8})[^"]*"\]$/;