| LEFT | RIGHT | 
|    1 /* |    1 /* | 
|    2  * This Source Code is subject to the terms of the Mozilla Public License |    2  * This Source Code is subject to the terms of the Mozilla Public License | 
|    3  * version 2.0 (the "License"). You can obtain a copy of the License at |    3  * version 2.0 (the "License"). You can obtain a copy of the License at | 
|    4  * http://mozilla.org/MPL/2.0/. |    4  * http://mozilla.org/MPL/2.0/. | 
|    5  */ |    5  */ | 
|    6  |    6  | 
|    7 let {Prefs} = require("prefs"); |    7 let {Prefs} = require("prefs"); | 
|    8  |    8  | 
|    9 let domainData; |    9 let domainData; | 
|   10 let nodeData; |   10 let nodeData; | 
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  241           else if (attr.value.substr(0, attr.selected.length) == attr.selected) |  241           else if (attr.value.substr(0, attr.selected.length) == attr.selected) | 
|  242             op = "^="; |  242             op = "^="; | 
|  243           else if (attr.value.substr(attr.value.length - attr.selected.length) =
     = attr.selected) |  243           else if (attr.value.substr(attr.value.length - attr.selected.length) =
     = attr.selected) | 
|  244             op = "$="; |  244             op = "$="; | 
|  245    |  245    | 
|  246           let useFallback = false; |  246           let useFallback = false; | 
|  247           if (attr.name == "id" && op == "=") |  247           if (attr.name == "id" && op == "=") | 
|  248             expression += "#" + escapeName(attr.selected).replace(/^([^a-zA-Z\\]
     )/, escapeChar).replace(/\\(\s)$/, escapeChar); |  248             expression += "#" + escapeName(attr.selected).replace(/^([^a-zA-Z\\]
     )/, escapeChar).replace(/\\(\s)$/, escapeChar); | 
|  249           else if (attr.name == "class" && /\S/.test(attr.selected)) |  249           else if (attr.name == "class" && /\S/.test(attr.selected)) | 
|  250           { |  250           { | 
|  251             let knownClasses = {}; |  251             let knownClasses = new Set(attr.value.split(/\s+/)); | 
|  252             for (let cls of attr.value.split(/\s+/)) |  | 
|  253               knownClasses[cls] = true; |  | 
|  254  |  | 
|  255             let classes = attr.selected.split(/\s+/).filter(cls => cls != ""); |  252             let classes = attr.selected.split(/\s+/).filter(cls => cls != ""); | 
|  256             if (classes.every(cls => knownClasses.hasOwnProperty(cls))) |  253             if (classes.every(cls => knownClasses.has(cls))) | 
|  257               expression += "." + classes.map(escapeName).join("."); |  254               expression += "." + classes.map(escapeName).join("."); | 
|  258             else |  255             else | 
|  259               useFallback = true; |  256               useFallback = true; | 
|  260           } |  257           } | 
|  261           else |  258           else | 
|  262             useFallback = true; |  259             useFallback = true; | 
|  263  |  260  | 
|  264           if (useFallback) |  261           if (useFallback) | 
|  265           { |  262           { | 
|  266             var escapedValue = attr.selected.replace(/(["\\])/g, '\\$1') |  263             var escapedValue = attr.selected.replace(/(["\\])/g, '\\$1') | 
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  631  |  628  | 
|  632   fillAttributes(item.nodeData); |  629   fillAttributes(item.nodeData); | 
|  633 } |  630 } | 
|  634  |  631  | 
|  635 function addExpression() |  632 function addExpression() | 
|  636 { |  633 { | 
|  637   AdblockPlus.addPatterns([document.getElementById("expression").value]); |  634   AdblockPlus.addPatterns([document.getElementById("expression").value]); | 
|  638  |  635  | 
|  639   togglePreview(false); |  636   togglePreview(false); | 
|  640 } |  637 } | 
| LEFT | RIGHT |