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

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

Issue 29712602: Noissue - Fix naming inconsistency in ContainsSelector (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created March 1, 2018, 1:36 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-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.
231 */ 230 */
232 *getSelectors(prefix, subtree, styles) 231 *getSelectors(prefix, subtree)
233 { 232 {
234 yield [prefix + this._selector, subtree]; 233 yield [prefix + this._selector, subtree];
235 } 234 }
236 }; 235 };
237 236
238 const incompletePrefixRegexp = /[\s>+~]$/; 237 const incompletePrefixRegexp = /[\s>+~]$/;
239 238
240 function HasSelector(selectors) 239 function HasSelector(selectors)
241 { 240 {
242 this._innerSelectors = selectors; 241 this._innerSelectors = selectors;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 300
302 function ContainsSelector(textContent) 301 function ContainsSelector(textContent)
303 { 302 {
304 this._regexp = makeRegExpParameter(textContent); 303 this._regexp = makeRegExpParameter(textContent);
305 } 304 }
306 305
307 ContainsSelector.prototype = { 306 ContainsSelector.prototype = {
308 requiresHiding: true, 307 requiresHiding: true,
309 dependsOnCharacterData: true, 308 dependsOnCharacterData: true,
310 309
311 *getSelectors(prefix, subtree, stylesheet) 310 *getSelectors(prefix, subtree)
312 { 311 {
313 for (let element of this.getElements(prefix, subtree, stylesheet)) 312 for (let element of this.getElements(prefix, subtree))
314 yield [makeSelector(element, ""), subtree]; 313 yield [makeSelector(element, ""), subtree];
315 }, 314 },
316 315
317 *getElements(prefix, subtree, stylesheet) 316 *getElements(prefix, subtree)
318 { 317 {
319 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? 318 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ?
320 prefix + "*" : prefix; 319 prefix + "*" : prefix;
321 320
322 let elements = scopedQuerySelectorAll(subtree, actualPrefix); 321 let elements = scopedQuerySelectorAll(subtree, actualPrefix);
323 if (elements) 322 if (elements)
324 { 323 {
325 for (let element of elements) 324 for (let element of elements)
326 { 325 {
327 if (this._regexp && this._regexp.test(element.textContent)) 326 if (this._regexp && this._regexp.test(element.textContent))
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 characterData: shouldObserveCharacterData(this.patterns), 711 characterData: shouldObserveCharacterData(this.patterns),
713 subtree: true 712 subtree: true
714 } 713 }
715 ); 714 );
716 this.document.addEventListener("load", this.onLoad.bind(this), true); 715 this.document.addEventListener("load", this.onLoad.bind(this), true);
717 } 716 }
718 } 717 }
719 }; 718 };
720 719
721 exports.ElemHideEmulation = ElemHideEmulation; 720 exports.ElemHideEmulation = ElemHideEmulation;
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