Skip to content

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