Skip to content

fix: render all slots inside a <template> vnode #979

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

Merged
merged 2 commits into from
Sep 27, 2018

Conversation

eddyerburgh
Copy link
Member

  • Wrap all slot vnodes created from a string in a template vnode

Fixes #967

}
const vnode = vm.$createElement(slotValue)
;(vnode.data || (vnode.data = {})).slot = name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this line do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sets vnode.data.slot to equal the slot name. It's shorthand for:

if(!vnode.data) {
  vnode.data = {}
}
vnode.data.slot = name

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see! haven't seen this syntax before. I take it the preceeding ; is required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's is one of the drawbacks of not including semi-colons, there are a few other cases where no semi-colons will cause errors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

Code looks good outside that, good job.

@eddyerburgh eddyerburgh merged commit c04d3bf into vuejs:dev Sep 27, 2018
@eddyerburgh eddyerburgh deleted the fix-named-slots branch September 27, 2018 17:57
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.

2 participants