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

lastComment is not consumed when emitted in onopentag of the HtmlParser callback handler #47

Closed
soft-decay opened this issue Jan 17, 2021 · 4 comments · Fixed by #62
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@soft-decay
Copy link
Contributor

soft-decay commented Jan 17, 2021

in onattribute, lastComment is comsumed (emitted and set to null):

if (!hasOwnProperty(this.eventsEmitted, baseEvent.name)) {
    this.eventsEmitted[baseEvent.name] = baseEvent;

    this.parseKeywords(comment.keywords, baseEvent);
    this.emit('event', baseEvent);
}

lastComment = null;

but it is only emitted in onopentag. It should be removed to prevent its application to other elements.

Example :
In https://svelte-materialify.vercel.app/api/TextField/, the comment 'Slot for prepend inside the input.' should only be applied to <slot name="prepend" /> but is also applied to <slot />, <slot name="content" />, and on:focus.

@alexprey
Copy link
Collaborator

Hi, I'll try to look at this

@alexprey alexprey added the bug Something isn't working label Jan 22, 2021
@alexprey alexprey self-assigned this Jan 22, 2021
@alexprey alexprey added this to the 4.0.0 milestone Jan 22, 2021
@alexprey
Copy link
Collaborator

Hi @soft-decay!
I'm fix this issue in this commit 9a7bfc4. This commit based on refactoring branch, I'm add few simple tests for that, but it will be good if you can check fix on your examples and approve that this fix are correct.

Thanks!

@soft-decay
Copy link
Contributor Author

Hi @alexprey,

Just checked and the problem is fixed in the example provided. Thanks.

@alexprey
Copy link
Collaborator

Perfect! So! I'll merge that

alexprey added a commit that referenced this issue Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants