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

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

Issue 29712602: Noissue - Fix naming inconsistency in ContainsSelector (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created March 1, 2018, 1:36 p.m.
Right Patch Set: Only fix naming inconsistency Created March 1, 2018, 7:11 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-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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 this._selector = selector; 220 this._selector = selector;
221 this.maybeDependsOnAttributes = /[#.]|\[.+\]/.test(selector); 221 this.maybeDependsOnAttributes = /[#.]|\[.+\]/.test(selector);
222 } 222 }
223 223
224 PlainSelector.prototype = { 224 PlainSelector.prototype = {
225 /** 225 /**
226 * Generator function returning a pair of selector 226 * Generator function returning a pair of selector
227 * string and subtree. 227 * string and subtree.
228 * @param {string} prefix the prefix for the selector. 228 * @param {string} prefix the prefix for the selector.
229 * @param {Node} subtree the subtree we work on. 229 * @param {Node} subtree the subtree we work on.
230 * @param {StringifiedStyle[]} styles the stringified style objects.
230 */ 231 */
231 *getSelectors(prefix, subtree) 232 *getSelectors(prefix, subtree, styles)
232 { 233 {
233 yield [prefix + this._selector, subtree]; 234 yield [prefix + this._selector, subtree];
234 } 235 }
235 }; 236 };
236 237
237 const incompletePrefixRegexp = /[\s>+~]$/; 238 const incompletePrefixRegexp = /[\s>+~]$/;
238 239
239 function HasSelector(selectors) 240 function HasSelector(selectors)
240 { 241 {
241 this._innerSelectors = selectors; 242 this._innerSelectors = selectors;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 function ContainsSelector(textContent) 302 function ContainsSelector(textContent)
302 { 303 {
303 this._regexp = makeRegExpParameter(textContent); 304 this._regexp = makeRegExpParameter(textContent);
304 } 305 }
305 306
306 ContainsSelector.prototype = { 307 ContainsSelector.prototype = {
307 requiresHiding: true, 308 requiresHiding: true,
308 dependsOnCharacterData: true, 309 dependsOnCharacterData: true,
309 310
310 *getSelectors(prefix, subtree) 311 *getSelectors(prefix, subtree, styles)
311 { 312 {
312 for (let element of this.getElements(prefix, subtree)) 313 for (let element of this.getElements(prefix, subtree, styles))
313 yield [makeSelector(element, ""), subtree]; 314 yield [makeSelector(element, ""), subtree];
314 }, 315 },
315 316
316 *getElements(prefix, subtree) 317 *getElements(prefix, subtree, styles)
317 { 318 {
318 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? 319 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ?
319 prefix + "*" : prefix; 320 prefix + "*" : prefix;
320 321
321 let elements = scopedQuerySelectorAll(subtree, actualPrefix); 322 let elements = scopedQuerySelectorAll(subtree, actualPrefix);
322 if (elements) 323 if (elements)
323 { 324 {
324 for (let element of elements) 325 for (let element of elements)
325 { 326 {
326 if (this._regexp && this._regexp.test(element.textContent)) 327 if (this._regexp && this._regexp.test(element.textContent))
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 characterData: shouldObserveCharacterData(this.patterns), 712 characterData: shouldObserveCharacterData(this.patterns),
712 subtree: true 713 subtree: true
713 } 714 }
714 ); 715 );
715 this.document.addEventListener("load", this.onLoad.bind(this), true); 716 this.document.addEventListener("load", this.onLoad.bind(this), true);
716 } 717 }
717 } 718 }
718 }; 719 };
719 720
720 exports.ElemHideEmulation = ElemHideEmulation; 721 exports.ElemHideEmulation = ElemHideEmulation;
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