Skip to content

Commit

Permalink
ensure binding event handlers precede normal ones (fixes #486)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Apr 16, 2017
1 parent cc21db3 commit ef52a93
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/generators/dom/visitors/Element/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const meta = {

const order = {
Attribute: 1,
EventHandler: 2,
Binding: 3,
Binding: 2,
EventHandler: 3,
Ref: 4
};

Expand Down
20 changes: 20 additions & 0 deletions test/runtime/samples/binding-input-with-event/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default {
data: {
a: 42
},

test ( assert, component, target, window ) {
const input = target.querySelector( 'input' );
assert.equal( input.value, '42' );

const event = new window.Event( 'input' );

input.value = 43;
input.dispatchEvent( event );

assert.equal( input.value, '43' );
assert.equal( component.get( 'a' ), 43 );

component.destroy();
}
};
1 change: 1 addition & 0 deletions test/runtime/samples/binding-input-with-event/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<input bind:value='a' on:input='set({ b: 0 })'>

0 comments on commit ef52a93

Please sign in to comment.