diff --git a/src/lib/style-transformer.html b/src/lib/style-transformer.html index 5333e26314..06ff23750d 100644 --- a/src/lib/style-transformer.html +++ b/src/lib/style-transformer.html @@ -295,7 +295,7 @@ // handle 2.x rules like `:host, html {}` var parts = rule.selector.split(COMPLEX_SELECTOR_SEP); parts = parts.filter(function(part) { - return part.trim() !== HOST; + return !part.match(HOST_OR_HOST_GT_STAR); }); rule.selector = parts.join(COMPLEX_SELECTOR_SEP); }, @@ -339,6 +339,7 @@ var CONTENT_START = new RegExp('^(' + CONTENT + ')'); var SELECTOR_NO_MATCH = 'should_not_match'; var SLOTTED_PAREN = /(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g; + var HOST_OR_HOST_GT_STAR = /:host(?:\s*>\s*\*)?/; // exports return api; diff --git a/test/unit/custom-style.html b/test/unit/custom-style.html index 54a4cf7ea0..3e926a51a7 100644 --- a/test/unit/custom-style.html +++ b/test/unit/custom-style.html @@ -143,7 +143,10 @@ @@ -325,9 +328,13 @@ @@ -409,6 +416,7 @@ test('polymer 2 shared styles applied', function() { var polymer2 = document.querySelector('polymer-2-root'); assertComputed(polymer2, '10px'); + assertComputed(polymer2.$.foo, '5px'); }) test('custom properties registered as defaults', function() {