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

Unified Diff: include.postload.js

Issue 5960705870135296: Fixed genrated filter rules for elements with CSS class (Closed)
Patch Set: Removed console.log() and simplified regex Created Jan. 24, 2014, 2:52 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.postload.js
===================================================================
--- a/include.postload.js
+++ b/include.postload.js
@@ -299,13 +299,15 @@
clickHideFilters.push(document.domain + "###" + elementId);
selectorList.push("#" + elementId);
}
- if (elementClasses)
+ if (elementClasses && elementClasses.length > 0)
{
- for(var i = 0; i < elementClasses.length; i++)
+ var selector = elementClasses.map(function(elClass)
{
- clickHideFilters.push(document.domain + "##." + elementClasses[i]);
- selectorList.push("." + elementClasses[i]);
- }
+ return "." + elClass.replace(/([^\w-])/, "\\$1");
+ }).join("");
+
+ clickHideFilters.push(document.domain + "##" + selector);
+ selectorList.push(selector);
}
if (url)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld