Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@host styles aren't processed for base elements #72

Closed
JanMiksovsky opened this issue Feb 11, 2013 · 1 comment
Closed

@host styles aren't processed for base elements #72

JanMiksovsky opened this issue Feb 11, 2013 · 1 comment

Comments

@JanMiksovsky
Copy link

A component that inherits styles from a base component doesn't appear to pick up the @host rules defined by its base component(s). The following sample demonstrates the issue:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Subclass styling</title>
<script src="platform/platform.js"></script>

<element name="base-element">
    <link rel="components" href="components/g-component.html">
    <template>
        <style>
        @host {
            color: red;
        }
        </style>
        <content></content>
    </template>
</element>

<element name="sub-element" extends="base-element">
    <link rel="components" href="components/g-component.html">
    <template>
        <style>
        @host {
            font-weight: bold;
        }
        </style>
        <shadow></shadow>
    </template>
</element>

</head>

<body>
    <base-element>
        I'm red
    </base-element>
    <sub-element>
        I should be red and bold
    </sub-element>
</body>

</html>

The instance of the does have the styles within processed such that "@host" is replaced with "sub-element". However, the styles of the base component, are injected as is, without "@host" processing. So the that wants to be both red and bold ends up being just bold.

@sorvell
Copy link
Contributor

sorvell commented Apr 18, 2013

These issues should be resolved now when running under both native and polyfill'd shadowDOM.

Also note, the @host syntax has been changed to match the spec so that the proper usage is:

@host {
  * { 
  }
}

@sorvell sorvell closed this as completed Apr 18, 2013
dfreedm pushed a commit that referenced this issue Sep 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants