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

Unified Diff: lib/content/elemHideEmulation.js

Issue 30011555: Issue 7303 - Deprecate the use of String.prototype.substr() (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebase. Revert changes in hot path. Created Feb. 21, 2019, 6:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/common.js ('k') | lib/filterClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/content/elemHideEmulation.js
===================================================================
--- a/lib/content/elemHideEmulation.js
+++ b/lib/content/elemHideEmulation.js
@@ -423,21 +423,21 @@
{
for (let style of styles)
if (regexp.test(style.style))
for (let subSelector of style.subSelectors)
{
if (subSelector.startsWith("*") &&
!incompletePrefixRegexp.test(prefix))
{
- subSelector = subSelector.substr(1);
+ subSelector = subSelector.substring(1);
}
let idx = subSelector.lastIndexOf("::");
if (idx != -1)
- subSelector = subSelector.substr(0, idx);
+ subSelector = subSelector.substring(0, idx);
yield qualifySelector(subSelector, prefix);
}
}
*getSelectors(prefix, subtree, styles, targets)
{
for (let selector of this.findPropsSelectors(styles, prefix, this._regexp))
yield [selector, subtree];
@@ -639,17 +639,17 @@
return [];
let match = abpSelectorRegexp.exec(selector);
if (!match)
return [new PlainSelector(selector)];
let selectors = [];
if (match.index > 0)
- selectors.push(new PlainSelector(selector.substr(0, match.index)));
+ selectors.push(new PlainSelector(selector.substring(0, match.index)));
let startIndex = match.index + match[0].length;
let content = parseSelectorContent(selector, startIndex);
if (!content)
{
console.error(new SyntaxError("Failed to parse Adblock Plus " +
`selector ${selector} ` +
"due to unmatched parentheses."));
@@ -670,17 +670,17 @@
{
// this is an error, can't parse selector.
console.error(new SyntaxError("Failed to parse Adblock Plus " +
`selector ${selector}, invalid ` +
`pseudo-class :-abp-${match[1]}().`));
return null;
}
- let suffix = this.parseSelector(selector.substr(content.end + 1));
+ let suffix = this.parseSelector(selector.substring(content.end + 1));
if (suffix == null)
return null;
selectors.push(...suffix);
if (selectors.length == 1 && selectors[0] instanceof ContainsSelector)
{
console.error(new SyntaxError("Failed to parse Adblock Plus " +
« no previous file with comments | « lib/common.js ('k') | lib/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld