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

View file

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