Skip to content

Commit

Permalink
Factor :dir replacement into a separate function for css building
Browse files Browse the repository at this point in the history
Fix test running erroneously in Safari 11 w customElements but not HTML
Imports
  • Loading branch information
dfreedm committed Oct 17, 2017
1 parent 63376cb commit 00a6405
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/lib/style-transformer.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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'
};

Expand Down
2 changes: 1 addition & 1 deletion test/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 00a6405

Please sign in to comment.