mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
Escape attribute values
Related issues: - https://github.com/uBlockOrigin/uBlock-issues/issues/2284#issuecomment-1265417399
This commit is contained in:
parent
76fe28333d
commit
24273d2c94
@ -40,7 +40,10 @@ let hintHelperRegistered = false;
|
|||||||
|
|
||||||
CodeMirror.defineMode('ubo-static-filtering', function() {
|
CodeMirror.defineMode('ubo-static-filtering', function() {
|
||||||
if ( StaticFilteringParser instanceof Object === false ) { return; }
|
if ( StaticFilteringParser instanceof Object === false ) { return; }
|
||||||
const parser = new StaticFilteringParser({ interactive: true });
|
const parser = new StaticFilteringParser({
|
||||||
|
interactive: true,
|
||||||
|
nativeCssHas: vAPI.webextFlavor.env.includes('native_css_has'),
|
||||||
|
});
|
||||||
|
|
||||||
const reURL = /\bhttps?:\/\/\S+/;
|
const reURL = /\bhttps?:\/\/\S+/;
|
||||||
const rePreparseDirectives = /^!#(?:if|endif|include )\b/;
|
const rePreparseDirectives = /^!#(?:if|endif|include )\b/;
|
||||||
|
@ -1586,7 +1586,7 @@ Parser.prototype.SelectorCompiler = class {
|
|||||||
if ( typeof value !== 'string' ) {
|
if ( typeof value !== 'string' ) {
|
||||||
value = data.value.name;
|
value = data.value.name;
|
||||||
}
|
}
|
||||||
out.push(`[${name}${data.matcher}"${value}"]`);
|
out.push(`[${name}${data.matcher}"${CSS.escape(value)}"]`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'ClassSelector':
|
case 'ClassSelector':
|
||||||
@ -1858,6 +1858,7 @@ Parser.prototype.SelectorCompiler = class {
|
|||||||
// backslash characters.
|
// backslash characters.
|
||||||
// Remove potentially present quotes before processing.
|
// Remove potentially present quotes before processing.
|
||||||
compileText(s) {
|
compileText(s) {
|
||||||
|
if ( s === '' ) { return; }
|
||||||
s = this.extractArg(s);
|
s = this.extractArg(s);
|
||||||
const match = this.reParseRegexLiteral.exec(s);
|
const match = this.reParseRegexLiteral.exec(s);
|
||||||
let regexDetails;
|
let regexDetails;
|
||||||
@ -1950,6 +1951,7 @@ Parser.prototype.SelectorCompiler = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compileAttrList(s) {
|
compileAttrList(s) {
|
||||||
|
if ( s === '' ) { return; }
|
||||||
const attrs = s.split('\s*,\s*');
|
const attrs = s.split('\s*,\s*');
|
||||||
const out = [];
|
const out = [];
|
||||||
for ( const attr of attrs ) {
|
for ( const attr of attrs ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user