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

app-grid class is not applied to distributed nodes #410

Closed
rslawik opened this issue Feb 10, 2017 · 6 comments
Closed

app-grid class is not applied to distributed nodes #410

rslawik opened this issue Feb 10, 2017 · 6 comments

Comments

@rslawik
Copy link

rslawik commented Feb 10, 2017

Description

app-grid class is not applied to distributed nodes

Expected outcome

Distributed nodes can be styled by app-grid.

Actual outcome

Distributed nodes are not styled.

Live Demo

https://jsbin.com/fuxekesune/edit?html,output

@blasten
Copy link
Contributor

blasten commented Feb 13, 2017

Just merged #396 which addresses this issue. Thanks!

@blasten blasten closed this as completed Feb 13, 2017
@rslawik
Copy link
Author

rslawik commented Feb 17, 2017

The merged solution uses a different approach. Clients are expected to add a container with class="app-grid":

<my-element>
  <div slot="header">add to header</div>
  <div slot="grid-content">
    <div class="app-grid">
      <div>1</div>
      <div>2</div>
      <div>3</div>
    </div>
  </div>
</my-element>

I wanted to suggest:

<my-element>
  <div slot="header">add to header</div>
  <div slot="gird-content">
      <div>1</div>
      <div class="wide-tile">2</div>
      <div>3</div>
  </div>
</my-element>

Is the former approach preferable? If so, why?
How can clients of <my-element> specify which child of the grid should be expandible? (E.g. "wide-tile" class in the latter approach.)

Currently the demo I prepared works in ShadyDOM, but not in ShadowDOM.

@blasten
Copy link
Contributor

blasten commented Feb 17, 2017

There are a few limitations in the custom property shim so I don't think we can support what you originally suggested. The current API (of app-grid) tries to work around those limitations ;)

@rslawik
Copy link
Author

rslawik commented Feb 18, 2017

Thank you for the explanation. I think it is worth documenting though.
For example a section to main README.md on how to use it (app-grid) for distributed children and which limitation we are trying to work around.

@rslawik
Copy link
Author

rslawik commented Apr 25, 2017

A follow up question. Under Shadow DOM v1 it is no longer possible to target a descendant in the slotted subtree (only top-level elements). The accepted solution:

<x-foo>
  <ul class="app-grid">
    <li class="expand-me">item</li>
  </ul>
</x-foo>

will not work - there is no way of applying any styles to any of the descendants of <ul>.

@frankiefu
Copy link
Contributor

Correct. In Shadow DOM v1, ::slotted can only take a compound selector. So the support has been dropped from app-grid in 2.0.

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