Skip to content

Supporting ie11 and inheritance of css variable with slotted components #296

Open
@reactuser35

Description

@reactuser35

I am trying to use css variables with ie 11 and I got stucked at one point.

Think that I have a layout element and icon element.My layout element only have slot and in that slot there are icon components. Dom tree be like here.

<my-layout>
  <my-icon type="large"></my-icon>
  <my-icon type="medium"></my-icon>
  <my-icon type="small"></my-icon>
</my-layout>

And my-icon component have these in its style:

:host {
  fill: var(--icon-default-fill-color, green);
 }
  • On Chrome when I run these code with my-layout component:

$0.style.setProperty('--icon-default-fill-color', 'yellow');

It sets the variable on my-laoyut component and all the icons below changes their color with yellow.It is OK.

  • On ie11 when I run these code with my-layout component:
ShadyCSS.styleSubtree(this, {
        '--icon-default-fill-color': 'yellow' 
});

It sets the variable on my-laoyut component successfuly.When I check it with below code it seems ok and returns 'yellow' as expected.

ShadyCSS.getComputedStyleValue($0, '--icon-default-fill-color')

But below(slotted) icon components color doesn't change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions