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

Unified Diff: abp2blocklist.js

Issue 29336525: Issue 3584 - Work around WebKit uppercase ID matching bug (Closed)
Patch Set: Created Feb. 16, 2016, 7:43 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: abp2blocklist.js
diff --git a/abp2blocklist.js b/abp2blocklist.js
index 71d227f3e66f9a9f9c044409840967523982d923..c4151e38f4494c335d87f5b08fb98c022bcc53cd 100644
--- a/abp2blocklist.js
+++ b/abp2blocklist.js
@@ -286,11 +286,24 @@ function logRules()
{
while (selectors.length)
{
+ let selector = selectors.splice(0, selectorLimit).join(", ");
addRule({
trigger: {"url-filter": matchDomain},
action: {type: "css-display-none",
- selector: selectors.splice(0, selectorLimit).join(", ")}
+ selector: selector}
});
+
+ // FIXME - Hack to work around WebKit bug whereby element IDs are
Sebastian Noack 2016/02/17 08:04:28 I feel that this won't be just a temporary workaro
kzar 2016/02/17 13:45:26 Done.
+ // converted to lowercase before being matched.
+ let lowercaseSelector = selector.replace(
+ /#[\w-]+/g, match => match.toLowerCase()
Sebastian Noack 2016/02/17 08:04:28 ID selectors can have escaped special chars, e.g #
kzar 2016/02/17 13:45:26 Acknowledged.
+ );
+ if (lowercaseSelector != selector)
+ addRule({
Sebastian Noack 2016/02/17 08:04:28 Ideally, we merge the lowercase variants with the
kzar 2016/02/17 13:45:26 Acknowledged.
+ trigger: {"url-filter": matchDomain},
+ action: {type: "css-display-none",
+ selector: lowercaseSelector}
+ });
}
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld