minor code review

This commit is contained in:
gorhill 2017-10-05 08:38:34 -04:00
parent 229edd6c0e
commit c49ba60f0b
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 11 additions and 14 deletions

View File

@ -948,25 +948,19 @@ FilterContainer.prototype.compileProceduralSelector = (function() {
break;
case ':has-text':
value = regexToRawValue.get(task[1]);
raw.push(
task[0],
'(',
value !== undefined ? value : '/' + task[1] + '/',
')'
);
if ( value === undefined ) {
value = '/' + task[1] + '/';
}
raw.push(task[0], '(', value, ')');
break;
case ':matches-css':
case ':matches-css-after':
case ':matches-css-before':
value = regexToRawValue.get(task[1].value);
raw.push(
task[0],
'(',
task[1].name,
': ',
value !== undefined ? value : '/' + task[1].value + '/',
')'
);
if ( value === undefined ) {
value = '/' + task[1].value + '/';
}
raw.push(task[0], '(', task[1].name, ': ', value, ')');
break;
case ':if':
case ':if-not':
@ -1033,6 +1027,9 @@ FilterContainer.prototype.compileProceduralSelector = (function() {
var compiled = compile(raw);
if ( compiled !== undefined ) {
compiled.raw = decompile(compiled);
if ( compiled.raw !== raw ) {
console.log(raw, '\n', compiled.raw, '\n');
}
compiled = JSON.stringify(compiled);
}
lastProceduralSelectorCompiled = compiled;