shadycss icon indicating copy to clipboard operation
shadycss copied to clipboard

mixin escapes local style scope for multiple elements

Open TimvdLippe opened this issue 8 years ago • 2 comments

From @yangchenyun on July 21, 2016 6:32

Description

In a DOM where there are indirectly nested elements; mixin for the top one will affect the rest. @justinfagnani I encounter this bug multiple times when developing go/yelement, the current workaround for me is the use !important on nested mixin items.

Live Demo

https://jsfiddle.net/bysyoLk8/

Expected Results

first shadow is shown; the nested shadow should be none first panel has padding, the nested should be none

Actual Results

shadow mixin of the outermost component is used for all components padding is used for all nested components

Browsers Affected

  • [x] Chrome
  • [ ] Firefox
  • [ ] Edge
  • [ ] Safari 9
  • [ ] Safari 8
  • [ ] IE 11

Versions

  • Polymer: HEAD
  • webcomponents: a few, in example, 's #containerContent etc.

Copied from original issue: Polymer/polymer#3791

TimvdLippe avatar Feb 11 '18 16:02 TimvdLippe

Minimal reproducible example: http://jsbin.com/kiwahutoya/edit?html,console,output This is probably a known limitation of the polyfill, but still unexpected. In this case, we define the mixin twice in the same tree, which means that all the CSS styles as defined in the first mixins are used, but all in the <nested-element> are discarded.

TimvdLippe avatar Feb 11 '18 16:02 TimvdLippe

The issue in the repro is that the style was not in the template. When that's fixed, this seems ok: http://jsbin.com/molazef/1/edit?html,console,output.

sorvell avatar Feb 22 '18 01:02 sorvell