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

Unified Diff: include.preload.js

Issue 29336409: Issue 3654 - Reuse splitSelector() from cssProperties.js (Closed)
Patch Set: Updated dependency Created Feb. 15, 2016, 8:23 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 | « dependencies ('k') | 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
@@ -381,47 +381,6 @@
return observer;
}
-function convertSelectorsForShadowDOM(selectors)
-{
- var result = [];
- var prefix = "::content ";
-
- for (var i = 0; i < selectors.length; i++)
- {
- var selector = selectors[i];
- if (selector.indexOf(",") == -1)
- {
- result.push(prefix + selector);
- continue;
- }
-
- var start = 0;
- var sep = "";
- for (var j = 0; j < selector.length; j++)
- {
- var chr = selector[j];
- if (chr == "\\")
- j++;
- else if (chr == sep)
- sep = "";
- else if (sep == "")
- {
- if (chr == '"' || chr == "'")
- sep = chr;
- else if (chr == ",")
- {
- result.push(prefix + selector.substring(start, j));
- start = j + 1;
- }
- }
- }
-
- result.push(prefix + selector.substring(start));
- }
-
- return result;
-}
-
function init(document)
{
var shadow = null;
@@ -472,7 +431,16 @@
// before each selector, in order to match elements within the
// insertion point.
if (shadow)
- selectors = convertSelectorsForShadowDOM(selectors);
+ {
+ var preparedSelectors = [];
+ for (var i = 0; i < selectors.length; i++)
+ {
+ var subSelectors = splitSelector(selectors[i]);
+ for (var j = 0; j < subSelectors.length; j++)
+ preparedSelectors.push("::content " + subSelectors[j]);
+ }
+ selectors = preparedSelectors;
+ }
// WebKit (and Blink?) apparently chokes when the selector list in a
// CSS rule is huge. So we split the elemhide selectors into groups.
« no previous file with comments | « dependencies ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld