From 8fd3e93c7e09669c55e40173835a668b71ad50cf Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Tue, 7 Nov 2017 15:29:08 -0800 Subject: [PATCH] Fix :dir selector when element uses CSS Custom Property Shim Fixes #4925 --- src/lib/style-properties.html | 24 ++++++++++++++++++------ test/unit/dir.html | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/lib/style-properties.html b/src/lib/style-properties.html index 83619fb120..54a6b317f9 100644 --- a/src/lib/style-properties.html +++ b/src/lib/style-properties.html @@ -426,6 +426,10 @@ rule.keyframesName, rule.transformedKeyframesName); }, + _hasDirOrHostContext: function(parsedSelector) { + return /:host-context|:dir/.test(parsedSelector); + }, + // Strategy: x scope shim a selector e.g. to scope `.x-foo-42` (via classes): // non-host selector: .a.x-foo -> .x-foo-42 .a.x-foo // host selector: x-foo.wide -> .x-foo-42.wide @@ -437,14 +441,22 @@ _scopeSelector: function(rule, hostRx, hostSelector, viaAttr, scopeId) { rule.transformedSelector = rule.transformedSelector || rule.selector; var selector = rule.transformedSelector; - var scope = viaAttr ? '[' + styleTransformer.SCOPE_NAME + '~=' + - scopeId + ']' : - '.' + scopeId; + var scope = styleTransformer._calcElementScope(scopeId, viaAttr); var parts = selector.split(','); for (var i=0, l=parts.length, p; (i + + + + + + + + +