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

Unified Diff: lib/filterClasses.js

Issue 5325266087837696: Issue 1675 - Use String.trim() to strip leading and trailing whitespaces (Firefox) (Closed)
Patch Set: Created Dec. 8, 2014, 5:24 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 | « chrome/content/ui/subscriptionSelection.js ('k') | lib/ui.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -147,13 +147,13 @@
if (/^\s*!/.test(text))
{
// Don't remove spaces inside comments
- return text.replace(/^\s+/, "").replace(/\s+$/, "");
+ return text.trim();
}
else if (Filter.elemhideRegExp.test(text))
{
// Special treatment for element hiding filters, right side is allowed to contain spaces
let [, domain, separator, selector] = /^(.*?)(#\@?#?)(.*)$/.exec(text);
- return domain.replace(/\s/g, "") + separator + selector.replace(/^\s+/, "").replace(/\s+$/, "");
+ return domain.replace(/\s/g, "") + separator + selector.trim();
}
else
return text.replace(/\s/g, "");
« no previous file with comments | « chrome/content/ui/subscriptionSelection.js ('k') | lib/ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld