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

Fix bug when adding empty components #2

Merged
merged 1 commit into from
Nov 5, 2016

Conversation

keyserfaty
Copy link
Contributor

@keyserfaty keyserfaty commented Nov 4, 2016

I found a small bug when creating an empty component (with no children) like this:

/** @jsx vhtml */

let items = ['one', 'two'];

const Item = ({ item, index, children }) => (
  <li id={index}>
    <h4>{item}</h4>
    {children}
  </li>
);

document.body.innerHTML = (
	 <div class="foo">
    <h1>Hi!</h1>
    <ul>
      { items.map( (item, index) => (
        <Item>
          This is item {item}!
        </Item>
      )) }
    </ul>
  </div>
);

This small change should fix it. Hope it helps!

@developit
Copy link
Owner

Looks good. I might have it actually create attrs if it doesn't exist so that elements can have children without attributes. Can do thst post-merge though!

@developit developit merged commit 7f14eae into developit:master Nov 5, 2016
@NekR
Copy link
Collaborator

NekR commented Dec 6, 2016

@developit Hmm.. so children aren't supported without attrs being added to sortof component. I think it would be good to fix that. I'll PR it if you agree.

@keyserfaty
Copy link
Contributor Author

Hey! That would be great @NekR. Haven't had the time to do it myself.

@developit
Copy link
Owner

Open to a PR for sure

@NekR
Copy link
Collaborator

NekR commented Dec 6, 2016

Okay, will do after #3 is resolved :-)

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

Successfully merging this pull request may close these issues.

3 participants