Skip to content

Commit

Permalink
allow duplicates of the same action on an element (#5875)
Browse files Browse the repository at this point in the history
  • Loading branch information
pushkine authored Jan 25, 2021
1 parent abf11bb commit 13e3d75
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/parse/state/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {

if (type === 'Binding' && directive_name !== 'this') {
check_unique(directive_name);
} else if (type !== 'EventHandler') {
} else if (type !== 'EventHandler' && type !== 'Action') {
check_unique(name);
}

Expand Down
1 change: 1 addition & 0 deletions test/parser/samples/action-duplicate/input.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<input use:autofocus use:autofocus>
34 changes: 34 additions & 0 deletions test/parser/samples/action-duplicate/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"html": {
"start": 0,
"end": 35,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 35,
"type": "Element",
"name": "input",
"attributes": [
{
"start": 7,
"end": 20,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
},
{
"start": 21,
"end": 34,
"type": "Action",
"name": "autofocus",
"modifiers": [],
"expression": null
}
],
"children": []
}
]
}
}

0 comments on commit 13e3d75

Please sign in to comment.