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

Unified Diff: include.preload.js

Issue 5504296699297792: Issue 1802 - Fix element hiding filters with multiple CSS selectors when using shadow DOM (Closed)
Patch Set: Added comment explaining regex Created Jan. 15, 2015, 12:56 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.preload.js
===================================================================
--- a/include.preload.js
+++ b/include.preload.js
@@ -182,8 +182,12 @@
{
shadow.appendChild(style);
+ // Add ::content pseudo-selector (to break out of the shadow DOM)
+ // before every selector, also considering element hiding filters
+ // that specify multiple CSS selectors seperated by comma, while
+ // ignoring commas inside quotes.
for (var i = 0; i < selectors.length; i++)
- selectors[i] = "::content " + selectors[i];
+ selectors[i] = selectors[i].replace(/(\s*)((?:[^,"']|"(?:\\"|[^"])*"|'(?:\\'|[^'])*')+)/g, "$1::content $2");
Wladimir Palant 2015/01/19 20:49:17 Trying to parse CSS selectors via regular expressi
Wladimir Palant 2015/01/19 20:58:15 Just my quick attempt at writing that state machin
Sebastian Noack 2015/01/22 07:37:12 Unfortunately it seems we in fact need a state mac
}
else
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld