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

Allow multiple event listeners on a single node #2709

Merged
merged 3 commits into from
May 12, 2019

Conversation

LostKobrakai
Copy link
Contributor

As described in #2688

@Conduitry
Copy link
Member

I think this sounds like a reasonable enhancement. Can you swap out the parser test though for a runtime test (like the others in test/runtime) which tests the behavior of the compiled component, rather than just looks at the AST?

@@ -376,6 +368,15 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
const colon_index = name.indexOf(':');
const type = colon_index !== -1 && get_directive_type(name.slice(0, colon_index));

if (unique_names.has(name) && type != "EventHandler") {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (unique_names.has(name) && type != "EventHandler") {
if (unique_names.has(name) && type !== "EventHandler") {

Not that it would really matter here, but we are trying to use non-coercion comparisons everywhere.

}, start);
}

unique_names.add(name);
Copy link
Member

Choose a reason for hiding this comment

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

It might be nicer to not even add to unique_names if we have a type of "EventHandler".

@LostKobrakai
Copy link
Contributor Author

@Conduitry I've implemented your suggestions into the pr.

@Rich-Harris Rich-Harris merged commit 861c742 into sveltejs:master May 12, 2019
@Rich-Harris
Copy link
Member

Thanks, this is a nice enhancement

@ematipico
Copy link
Contributor

Should the documentation be updated?

ematipico added a commit to ematipico/svelte that referenced this pull request May 20, 2019
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.

4 participants