Skip to content

Conversation

lmiller1990
Copy link
Member

resolves #202

Copy link
Member

@cexbrayat cexbrayat left a comment

Choose a reason for hiding this comment

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

I'm curious why this is needed. Does it mean that compile from core has an issue?

Otherwise, LGTM

src/mount.ts Outdated
if (typeof slot === 'string') {
// slot is most probably a scoped slot string or a plain string
acc[name] = (props: VNodeProps) => h(processSlot(slot), props)
acc[name] = (props: VNodeProps) => h(processSlot(slot.trim()), props)
Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe trim should be called in processSlot (as if someone uses it in an other place of VTU, we don't have the same issue another time)

Copy link
Member Author

Choose a reason for hiding this comment

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

@cexbrayat I am curious too... I had a little look but it wasn't obvious why this was causing and issue. I guess no one has tried calling compile where the first character is a carriage return 🤔

I wonder if this should be fixed in core.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ohh I bet this is the issue https://github.com/vuejs/vue-test-utils-next/blob/e92bdcb430b6098204d20c5ea3b9c80bd21ddba7/src/utils/compileSlots.ts#L5

startsWith('<template') is not the same as startsWith('\ntemplate').

Copy link
Member Author

Choose a reason for hiding this comment

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

I made your suggested change! thanks.

@lmiller1990 lmiller1990 merged commit 1aed7a9 into master Sep 11, 2020
@cexbrayat cexbrayat deleted the issue-202 branch April 6, 2022 13:19
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.

Passing raw HTML to a slot mounting option breaks when starting with a carriage return

2 participants