diff --git a/packages/ember-views/lib/components/component.js b/packages/ember-views/lib/components/component.js index 6dd7ea44c27..ac8b1d8c0e6 100644 --- a/packages/ember-views/lib/components/component.js +++ b/packages/ember-views/lib/components/component.js @@ -1,4 +1,5 @@ import { assert, deprecate } from 'ember-metal/debug'; +import environment from 'ember-metal/environment'; import TargetActionSupport from 'ember-runtime/mixins/target_action_support'; import View from 'ember-views/views/view'; @@ -163,7 +164,7 @@ var Component = View.extend(TargetActionSupport, { // If in a tagless component, assert that no event handlers are defined assert( `You can not define a function that handles DOM events in the \`${this}\` tagless component since it doesn't have any DOM element.`, - this.tagName !== '' || !(() => { + this.tagName !== '' || !environment.hasDOM || !(() => { let eventDispatcher = getOwner(this).lookup('event_dispatcher:main'); let events = (eventDispatcher && eventDispatcher._finalEvents) || {}; diff --git a/packages/ember-views/lib/system/event_dispatcher.js b/packages/ember-views/lib/system/event_dispatcher.js index 412a5a81839..955f810729b 100644 --- a/packages/ember-views/lib/system/event_dispatcher.js +++ b/packages/ember-views/lib/system/event_dispatcher.js @@ -14,6 +14,7 @@ import ActionManager from 'ember-views/system/action_manager'; import View from 'ember-views/views/view'; import assign from 'ember-metal/assign'; import { getOwner } from 'container/owner'; +import environment from 'ember-metal/environment'; let ROOT_ELEMENT_CLASS = 'ember-application'; let ROOT_ELEMENT_SELECTOR = '.' + ROOT_ELEMENT_CLASS; @@ -136,6 +137,11 @@ export default EmberObject.extend({ */ canDispatchToEventManager: true, + init() { + this._super(); + assert('EventDispatcher should never be instantiated in fastboot mode. Please report this as an Ember bug.', environment.hasDOM); + }, + /** Sets up event listeners for standard browser events. diff --git a/tests/node/visit-test.js b/tests/node/visit-test.js index 493311212ce..9c15113e89d 100644 --- a/tests/node/visit-test.js +++ b/tests/node/visit-test.js @@ -301,4 +301,21 @@ if (appModule.canRunTests) { assert.strictEqual(xFooInstances, 0, 'it should not create any x-foo components'); }); }); + + QUnit.test('FastBoot: tagless components can render', function(assert) { + this.template('application', "