Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/content/elemHideEmulation.js

Issue 30002601: Issue 7284 - Move CSS escaping to createStyleSheet (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Reworked the escaping of selectors Created Feb. 12, 2019, 11:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/elemHide.js » ('j') | lib/elemHide.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 } 342 }
343 } 343 }
344 344
345 class ContainsSelector 345 class ContainsSelector
346 { 346 {
347 constructor(textContent) 347 constructor(textContent)
348 { 348 {
349 this.dependsOnDOM = true; 349 this.dependsOnDOM = true;
350 this.dependsOnCharacterData = true; 350 this.dependsOnCharacterData = true;
351
Manish Jethani 2019/02/13 12:27:25 Unrelated?
hub 2019/02/13 16:33:31 This shouldn't have been here, indeed. Done.
352 this._regexp = makeRegExpParameter(textContent); 351 this._regexp = makeRegExpParameter(textContent);
353 } 352 }
354 353
355 *getSelectors(prefix, subtree, styles, targets) 354 *getSelectors(prefix, subtree, styles, targets)
356 { 355 {
357 for (let element of this.getElements(prefix, subtree, styles, targets)) 356 for (let element of this.getElements(prefix, subtree, styles, targets))
358 yield [makeSelector(element), subtree]; 357 yield [makeSelector(element), subtree];
359 } 358 }
360 359
361 *getElements(prefix, subtree, styles, targets) 360 *getElements(prefix, subtree, styles, targets)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 { 403 {
405 constructor(propertyExpression) 404 constructor(propertyExpression)
406 { 405 {
407 this.dependsOnStyles = true; 406 this.dependsOnStyles = true;
408 this.dependsOnDOM = true; 407 this.dependsOnDOM = true;
409 408
410 let regexpString; 409 let regexpString;
411 if (propertyExpression.length >= 2 && propertyExpression[0] == "/" && 410 if (propertyExpression.length >= 2 && propertyExpression[0] == "/" &&
412 propertyExpression[propertyExpression.length - 1] == "/") 411 propertyExpression[propertyExpression.length - 1] == "/")
413 { 412 {
414 regexpString = propertyExpression.slice(1, -1) 413 regexpString = propertyExpression.slice(1, -1);
415 .replace("\\7B ", "{").replace("\\7D ", "}");
416 } 414 }
417 else 415 else
418 regexpString = filterToRegExp(propertyExpression); 416 regexpString = filterToRegExp(propertyExpression);
419 417
420 this._regexp = new RegExp(regexpString, "i"); 418 this._regexp = new RegExp(regexpString, "i");
421 } 419 }
422 420
423 *findPropsSelectors(styles, prefix, regexp) 421 *findPropsSelectors(styles, prefix, regexp)
424 { 422 {
425 for (let style of styles) 423 for (let style of styles)
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 characterData: shouldObserveCharacterData(this.patterns), 963 characterData: shouldObserveCharacterData(this.patterns),
966 subtree: true 964 subtree: true
967 } 965 }
968 ); 966 );
969 this.document.addEventListener("load", this.onLoad.bind(this), true); 967 this.document.addEventListener("load", this.onLoad.bind(this), true);
970 } 968 }
971 } 969 }
972 } 970 }
973 971
974 exports.ElemHideEmulation = ElemHideEmulation; 972 exports.ElemHideEmulation = ElemHideEmulation;
OLDNEW
« no previous file with comments | « no previous file | lib/elemHide.js » ('j') | lib/elemHide.js » ('J')

Powered by Google App Engine
This is Rietveld