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

Exclude attributes managed by the component itself from the demo snippet #83

Open
yinonov opened this issue Nov 3, 2021 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@yinonov
Copy link

yinonov commented Nov 3, 2021

web component may render differently than its origin html snippet (eager attributes).
in such cases authors might want source to freeze
this programmatic mutation of dom tree is probably an anti-pattern but still can be an interim and causes confusion in docs.

@web-padawan
Copy link
Collaborator

Hi, thanks for the issue. Could you please elaborate a bit with some concrete example of what you would expect?

web component may render differently than its origin html snippet

If you mean some "state" attributes (e.g. in Vaadin components we use has-value, has-label etc based on presence of a certain property), then it's out of scope for now. If CEM analyzer supports states, we can add those of course.

@yinonov
Copy link
Author

yinonov commented Nov 3, 2021

take spectrum's button for example.
in order to render the following button
image
we should simply author <sp-button>OK</sp-button>

the rendered dom tree, however, would output
<sp-button dir="ltr" variant="cta" focusable="" tabindex="0" role="button" size="m">OK</sp-button>

but we wouldn't want authors to get the wrong information and have all that unnecessary code presented in the source tab

@web-padawan
Copy link
Collaborator

Thanks, so my assumption above was correct. I will try some Vaadin components and see how to handle these "state" attributes that the component owns and distinguish them from "props" that the consumer typically provides.

@web-padawan web-padawan added the enhancement New feature or request label Nov 3, 2021
@web-padawan web-padawan changed the title [live-playground] pre-rendered source Exclude attributes managed by the component itself from the demo snippet Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants