From 00a64050b42a0b2e087bdd2149a40a243e58101e Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Tue, 17 Oct 2017 15:39:00 -0700 Subject: [PATCH] Factor :dir replacement into a separate function for css building Fix test running erroneously in Safari 11 w customElements but not HTML Imports --- src/lib/style-transformer.html | 14 +++++++++----- test/runner.html | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lib/style-transformer.html b/src/lib/style-transformer.html index 94775b5589..60503fe75e 100644 --- a/src/lib/style-transformer.html +++ b/src/lib/style-transformer.html @@ -109,11 +109,7 @@ cb = function(rule) { rule.selector = self._slottedToContent(rule.selector); rule.selector = rule.selector.replace(ROOT, ':host > *'); - rule.selector = rule.selector.split(',').map(function(s) { - s = s.replace(HOST_DIR, HOST_DIR_REPLACE); - s = s.replace(DIR_PAREN, SHADOW_DIR_REPLACE); - return s; - }).join(','); + rule.selector = self._dirShadowTransform(rule.selector); if (callback) { callback(rule); } @@ -320,6 +316,14 @@ return cssText.replace(SLOTTED_PAREN, CONTENT + '> $1'); }, + _dirShadowTransform: function(selector) { + return selector.split(',').map(function(s) { + s = s.replace(HOST_DIR, HOST_DIR_REPLACE); + s = s.replace(DIR_PAREN, SHADOW_DIR_REPLACE); + return s; + }).join(','); + }, + SCOPE_NAME: 'style-scope' }; diff --git a/test/runner.html b/test/runner.html index a5a6803e73..d18d6ba6ca 100644 --- a/test/runner.html +++ b/test/runner.html @@ -105,7 +105,7 @@ 'unit/custom-style-transformed.html?lazyRegister=true&useNativeCSSProperties=true&dom=shadow' ]; - if (window.customElements || document.registerElement) { + if ('import' in document.createElement('link') && (window.customElements || document.registerElement)) { suites.push('unit/attach-detach-timing.html'); } if (/edge/i.test(navigator.userAgent)) {