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

Allow explicit inheritance when re-defining a custom property set #49

Closed
bendavis78 opened this issue Nov 18, 2015 · 2 comments
Closed

Comments

@bendavis78
Copy link

See here for the origin of this issue in Polymer: Polymer/polymer#2487

I'm curious of whether or not the spec defines what happens in this case:

:host {
  --paper-dropdown-menu-icon: {
    @apply(--paper-dropdown-menu-icon);
    padding-right: 12px;
  }
}

The idea here is that the author of a custom web component should be able to extend an existing property set (for example, from a commonly-used theme) without wiping out the properties in the previously defined property set. In the above example, the inner @apply would just apply whatever properties were previously defined as part of that set.

Right now Polymer doesn't handle the above syntax well; it results in a recursive loop. Has this usage been considred in the spec?

@tabatkins
Copy link
Owner

Spec hasn't been updated yet to reflect this, but I'm going to expand @apply inside of custom properties, too, identically to how var() works today. This means your example would be an loop, and would invalidate the property.

This'll be fixed with the ability to refer to the value of a custom property from your parent, in both var() and @apply, because "building up" a value as you descend the tree is definitely useful; right now you have to do tricky hacks to make it work.

(In general, if something works a certain way with var(), it'll work the same way with @apply.)

@nazar-pc
Copy link

@tabatkins, can you ping us at Polymer/polymer#2487 when done so that we would be able to implement it quickly in Polymer?

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

3 participants