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

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

Issue 29490698: Issue 5422 - Properly build props selector (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Another nit Created Aug. 19, 2017, 1:13 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 | no next file » | 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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 PropsSelector.prototype = { 273 PropsSelector.prototype = {
274 preferHideWithSelector: true, 274 preferHideWithSelector: true,
275 dependsOnStyles: true, 275 dependsOnStyles: true,
276 276
277 *findPropsSelectors(styles, prefix, regexp) 277 *findPropsSelectors(styles, prefix, regexp)
278 { 278 {
279 for (let style of styles) 279 for (let style of styles)
280 if (regexp.test(style.style)) 280 if (regexp.test(style.style))
281 for (let subSelector of style.subSelectors) 281 for (let subSelector of style.subSelectors)
282 { 282 {
283 if (subSelector.startsWith("*") &&
284 !incompletePrefixRegexp.test(prefix))
285 {
286 subSelector = subSelector.substr(1);
287 }
283 let idx = subSelector.lastIndexOf("::"); 288 let idx = subSelector.lastIndexOf("::");
284 if (idx != -1) 289 if (idx != -1)
285 subSelector = subSelector.substr(0, idx); 290 subSelector = subSelector.substr(0, idx);
286 yield prefix + subSelector; 291 yield prefix + subSelector;
287 } 292 }
288 }, 293 },
289 294
290 *getSelectors(prefix, subtree, styles) 295 *getSelectors(prefix, subtree, styles)
291 { 296 {
292 for (let selector of this.findPropsSelectors(styles, prefix, this._regexp)) 297 for (let selector of this.findPropsSelectors(styles, prefix, this._regexp))
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 510
506 if (this.patterns.length > 0) 511 if (this.patterns.length > 0)
507 { 512 {
508 let {document} = this.window; 513 let {document} = this.window;
509 this.addSelectors(); 514 this.addSelectors();
510 document.addEventListener("load", this.onLoad.bind(this), true); 515 document.addEventListener("load", this.onLoad.bind(this), true);
511 } 516 }
512 }); 517 });
513 } 518 }
514 }; 519 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld