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

Support multiple top level DOM elements for a component #393

Closed
mlrawlings opened this issue Nov 4, 2016 · 0 comments
Closed

Support multiple top level DOM elements for a component #393

mlrawlings opened this issue Nov 4, 2016 · 0 comments
Assignees
Milestone

Comments

@mlrawlings
Copy link
Member

In a way, this is the relates to/is the inverse of #392 which would allow an element to be bound to multiple components, and removes the need for a wrapper element.

Right now there is the limitation that a component can only be bound to a single element.

If I have the following:

<h1>The current count is, ${data.count}</h1>
<button>Increment Count</button>

And want to bind a component, I will have to wrap them with another element:

<div w-bind>
    <h1>The current count is, ${data.count}</h1>
    <button onClick('incrementCount')>Increment Count</button>
</div>

It's also a little weird that you can have markup for a widget that isn't bound to the widget:

<div w-bind>Hey, ${data.name</div>
<div>I'm just here, not actually bound</div>

If, instead we could bind all top level DOM elements in a template that is set to be a component, that would mean no need for w-bind (assuming we use the presence of a component.js or widget.js to indicate that this should be a component).

It would be nice if the following just worked:

<h1>The current count is, ${data.count}</h1>
<button onClick('incrementCount')>Increment Count</button>
@mlrawlings mlrawlings added this to the 4.0 milestone Nov 4, 2016
@patrick-steele-idem patrick-steele-idem self-assigned this Dec 2, 2016
@patrick-steele-idem patrick-steele-idem changed the title Maybe: Add support for binding multiple top level DOM elements for a component Support binding multiple top level DOM elements to a component Dec 2, 2016
@patrick-steele-idem patrick-steele-idem changed the title Support binding multiple top level DOM elements to a component Support multiple top level DOM elements for a component Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants