diff --git a/src/ShadowCSS.js b/src/ShadowCSS.js index f9a9fd6..1532c35 100644 --- a/src/ShadowCSS.js +++ b/src/ShadowCSS.js @@ -410,11 +410,16 @@ var ShadowCSS = { return cssText.replace(cssColonHostRe, function(m, p1, p2, p3) { p1 = polyfillHostNoCombinator; if (p2) { - if (p2.match(polyfillHost)) { - return p1 + p2.replace(polyfillHost, '') + p3; - } else { - return p1 + p2 + p3 + ', ' + p2 + ' ' + p1 + p3; + var parts = p2.split(','), r = []; + for (var i=0, l=parts.length, p; (iExpected: red background with black text and orange border and 20px padding<

Expected: 20px padding, background green

+ +

Expected: 20px padding, background green

+
+ +

Expected: 20px padding

@@ -228,11 +233,16 @@

Expected: blue background

chai.assert.equal(zimStyle2.backgroundColor, 'rgb(0, 128, 0)', ':host(.foo:host) styles are applied (backgroundColor)'); - var zim2_2 = document.querySelector('.foo x-zim2'); + var zim2_2 = document.querySelector('.bar > x-zim2'); var zimStyle2_2 = getComputedStyle(zim2_2); - chai.assert.equal(zimStyle2.backgroundColor, 'rgb(0, 128, 0)', + chai.assert.equal(zimStyle2_2.backgroundColor, 'rgb(0, 128, 0)', ':host(.foo:host) styles are applied (backgroundColor)'); + var zim2_3 = document.querySelector('.foo > x-zim2'); + var zimStyle2_3 = getComputedStyle(zim2_3); + chai.assert.notEqual(zimStyle2_3.backgroundColor, 'rgb(0, 128, 0)', + ':host(.foo:host) styles are not applied when host doesn\'t contain .foo (backgroundColor)'); + var btn = document.querySelector('[is=x-button]'); var btnStyle = getComputedStyle(btn); chai.assert.equal(btnStyle.backgroundColor, 'rgb(0, 128, 0)',