diff --git a/html5/default/vm/directive.js b/html5/default/vm/directive.js index a77b9cdc65..fc8013a977 100644 --- a/html5/default/vm/directive.js +++ b/html5/default/vm/directive.js @@ -287,8 +287,7 @@ function bindEvents (vm, el, events) { console.debug(`[JS Framework] The method "${handler}" is not defined.`) } } - const realVm = vm._realParent ? vm._realParent : vm - setEvent(realVm, el, key, handler) + setEvent(vm, el, key, handler) } } diff --git a/html5/test/unit/default/vm/events.js b/html5/test/unit/default/vm/events.js index ce57e6656b..26d98e8c6f 100644 --- a/html5/test/unit/default/vm/events.js +++ b/html5/test/unit/default/vm/events.js @@ -79,61 +79,6 @@ describe('bind and fire events', () => { }) }) - it('context of event binding to element width repeat attribute', (done) => { - customComponentMap.foo = { - template: { - type: 'div', - id: 'container', - events: { - click: 'containerClick' - }, - children: [ - { - type: 'div', - id: 'items', - 'repeat': function () { return this.items }, - events: { - click: 'itemsClick' - }, - children: [ - { - type: 'div' - } - ] - } - ] - }, - data: function () { - return { - items: [ - { name: 1 }, - { name: 2 } - ] - } - }, - methods: { - containerClick: function () { - expect(this).eql(vm) - }, - itemsClick: function () { - expect(this).eql(vm) - } - } - } - - const app = { doc, customComponentMap } - const vm = new Vm('foo', customComponentMap.foo, { _app: app }) - - checkReady(vm, function () { - doc.close() - const containerEl = vm.$el('container') - const itemsEl = vm.$el('items') - containerEl.event.click() - itemsEl.event.click() - done() - }) - }) - it('emit, broadcast and dispatch vm events', (done) => { customComponentMap.foo = { template: {