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: Nits addressed Created Feb. 18, 2019, 12:55 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') | no next file with comments »
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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 351
352 this._regexp = makeRegExpParameter( 352 this._regexp = makeRegExpParameter(textContent);
353 textContent.replace("\\7B ", "{").replace("\\7D ", "}"));
354 } 353 }
355 354
356 *getSelectors(prefix, subtree, styles, targets) 355 *getSelectors(prefix, subtree, styles, targets)
357 { 356 {
358 for (let element of this.getElements(prefix, subtree, styles, targets)) 357 for (let element of this.getElements(prefix, subtree, styles, targets))
359 yield [makeSelector(element), subtree]; 358 yield [makeSelector(element), subtree];
360 } 359 }
361 360
362 *getElements(prefix, subtree, styles, targets) 361 *getElements(prefix, subtree, styles, targets)
363 { 362 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 { 404 {
406 constructor(propertyExpression) 405 constructor(propertyExpression)
407 { 406 {
408 this.dependsOnStyles = true; 407 this.dependsOnStyles = true;
409 this.dependsOnDOM = true; 408 this.dependsOnDOM = true;
410 409
411 let regexpString; 410 let regexpString;
412 if (propertyExpression.length >= 2 && propertyExpression[0] == "/" && 411 if (propertyExpression.length >= 2 && propertyExpression[0] == "/" &&
413 propertyExpression[propertyExpression.length - 1] == "/") 412 propertyExpression[propertyExpression.length - 1] == "/")
414 { 413 {
415 regexpString = propertyExpression.slice(1, -1) 414 regexpString = propertyExpression.slice(1, -1);
416 .replace("\\7B ", "{").replace("\\7D ", "}");
417 } 415 }
418 else 416 else
419 regexpString = filterToRegExp(propertyExpression); 417 regexpString = filterToRegExp(propertyExpression);
420 418
421 this._regexp = new RegExp(regexpString, "i"); 419 this._regexp = new RegExp(regexpString, "i");
422 } 420 }
423 421
424 *findPropsSelectors(styles, prefix, regexp) 422 *findPropsSelectors(styles, prefix, regexp)
425 { 423 {
426 for (let style of styles) 424 for (let style of styles)
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 characterData: shouldObserveCharacterData(this.patterns), 964 characterData: shouldObserveCharacterData(this.patterns),
967 subtree: true 965 subtree: true
968 } 966 }
969 ); 967 );
970 this.document.addEventListener("load", this.onLoad.bind(this), true); 968 this.document.addEventListener("load", this.onLoad.bind(this), true);
971 } 969 }
972 } 970 }
973 } 971 }
974 972
975 exports.ElemHideEmulation = ElemHideEmulation; 973 exports.ElemHideEmulation = ElemHideEmulation;
OLDNEW
« no previous file with comments | « no previous file | lib/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld