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

Side by Side Diff: lib/common.js

Issue 30011555: Issue 7303 - Deprecate the use of String.prototype.substr() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebase Created Feb. 21, 2019, 2:48 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/content/elemHideEmulation.js » ('j') | lib/filterClasses.js » ('J')
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 { 195 {
196 let qualifiedSelector = ""; 196 let qualifiedSelector = "";
197 197
198 for (let sub of splitSelector(selector)) 198 for (let sub of splitSelector(selector))
199 { 199 {
200 sub = sub.trim(); 200 sub = sub.trim();
201 201
202 qualifiedSelector += ", "; 202 qualifiedSelector += ", ";
203 203
204 let index = findTargetSelectorIndex(sub); 204 let index = findTargetSelectorIndex(sub);
205 let [, type = "", rest] = /^([a-z][a-z-]*)?(.*)/i.exec(sub.substr(index)); 205 let [, type = "", rest] = /^([a-z][a-z-]*)?(.*)/i.exec(sub.substring(index)) ;
206 206
207 // Note that the first group in the regular expression is optional. If it 207 // Note that the first group in the regular expression is optional. If it
208 // doesn't match (e.g. "#foo::nth-child(1)"), type will be an empty string. 208 // doesn't match (e.g. "#foo::nth-child(1)"), type will be an empty string.
209 qualifiedSelector += sub.substr(0, index) + type + qualifier + rest; 209 qualifiedSelector += sub.substring(0, index) + type + qualifier + rest;
210 } 210 }
211 211
212 // Remove the initial comma and space. 212 // Remove the initial comma and space.
213 return qualifiedSelector.substr(2); 213 return qualifiedSelector.substring(2);
214 } 214 }
215 215
216 exports.qualifySelector = qualifySelector; 216 exports.qualifySelector = qualifySelector;
OLDNEW
« no previous file with comments | « no previous file | lib/content/elemHideEmulation.js » ('j') | lib/filterClasses.js » ('J')

Powered by Google App Engine
This is Rietveld