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

Delta Between Two Patch Sets: chrome/content/elemHideEmulation.js

Issue 29490698: Issue 5422 - Properly build props selector (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Changes following review. Created Aug. 16, 2017, 7:48 p.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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("*")) 283 if (subSelector.startsWith("*") &&
284 if (!incompletePrefixRegexp.test(prefix)) 284 !incompletePrefixRegexp.test(prefix))
Wladimir Palant 2017/08/17 08:53:08 Please use && operator instead of nested ifs.
hub 2017/08/19 02:12:51 Done.
285 subSelector = subSelector.substr(1); 285 {
286 subSelector = subSelector.substr(1);
287 }
286 let idx = subSelector.lastIndexOf("::"); 288 let idx = subSelector.lastIndexOf("::");
287 if (idx != -1) 289 if (idx != -1)
288 subSelector = subSelector.substr(0, idx); 290 subSelector = subSelector.substr(0, idx);
289 yield prefix + subSelector; 291 yield prefix + subSelector;
290 } 292 }
291 }, 293 },
292 294
293 *getSelectors(prefix, subtree, styles) 295 *getSelectors(prefix, subtree, styles)
294 { 296 {
295 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
508 510
509 if (this.patterns.length > 0) 511 if (this.patterns.length > 0)
510 { 512 {
511 let {document} = this.window; 513 let {document} = this.window;
512 this.addSelectors(); 514 this.addSelectors();
513 document.addEventListener("load", this.onLoad.bind(this), true); 515 document.addEventListener("load", this.onLoad.bind(this), true);
514 } 516 }
515 }); 517 });
516 } 518 }
517 }; 519 };
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld