Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions packages/@ember/-internals/environment/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,6 @@ export const ENV = {

STRUCTURED_PROFILE: false,

/**
Whether to insert a `<div class="ember-view" />` wrapper around the
application template. See RFC #280.

This is not intended to be set directly, as the implementation may change in
the future. Use `@ember/optional-features` instead.

@property _APPLICATION_TEMPLATE_WRAPPER
@for EmberENV
@type Boolean
@default true
@private
*/
_APPLICATION_TEMPLATE_WRAPPER: true,

/**
Whether to use Glimmer Component semantics (as opposed to the classic "Curly"
components semantics) for template-only components. See RFC #278.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { ENV } from '@ember/-internals/environment';
import type { InternalOwner } from '@ember/-internals/owner';
import { guidFor } from '@ember/-internals/utils';
import { assert } from '@ember/debug';
import EngineInstance from '@ember/engine/instance';
import { _instrumentStart } from '@ember/instrumentation';
Expand All @@ -17,7 +15,6 @@ import type {
VMArguments,
WithCreateInstance,
WithCustomDebugRenderTree,
WithDynamicTagName,
} from '@glimmer/interfaces';
import type { Nullable } from '@ember/-internals/utility-types';
import { capabilityFlagsFrom } from '@glimmer/manager';
Expand All @@ -26,7 +23,6 @@ import { createConstRef, valueForRef } from '@glimmer/reference';
import { EMPTY_ARGS } from '@glimmer/runtime';
import { unwrapTemplate } from '@glimmer/util';

import type { SimpleElement } from '@simple-dom/interface';
import type { DynamicScope } from '../renderer';
import type { OutletState } from '../utils/outlet';
import type OutletView from '../views/outlet';
Expand Down Expand Up @@ -211,36 +207,5 @@ export class OutletComponentDefinition
}

export function createRootOutlet(outletView: OutletView): OutletComponentDefinition {
if (ENV._APPLICATION_TEMPLATE_WRAPPER) {
const WRAPPED_CAPABILITIES = Object.assign({}, CAPABILITIES, {
dynamicTag: true,
elementHook: true,
wrapped: true,
});

const WrappedOutletComponentManager = class
extends OutletComponentManager
implements WithDynamicTagName<OutletInstanceState>
{
getTagName() {
return 'div';
}

getCapabilities(): InternalComponentCapabilities {
return WRAPPED_CAPABILITIES;
}

didCreateElement(component: OutletInstanceState, element: SimpleElement): void {
// to add GUID id and class
element.setAttribute('class', 'ember-view');
element.setAttribute('id', guidFor(component));
}
};

const WRAPPED_OUTLET_MANAGER = new WrappedOutletComponentManager();

return new OutletComponentDefinition(outletView.state, WRAPPED_OUTLET_MANAGER);
} else {
return new OutletComponentDefinition(outletView.state);
}
return new OutletComponentDefinition(outletView.state);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1637,9 +1637,7 @@ if (ENV._DEBUG_RENDER_TREE) {
args: { positional: [], named: {} },
instance: undefined,
template: outlet,
bounds: ENV._APPLICATION_TEMPLATE_WRAPPER
? this.nodeBounds(this.element)
: this.elementBounds(this.element!),
bounds: this.elementBounds(this.element!),
children: [
this.outlet({
type: 'route-template',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ moduleFor(
class extends ApplicationTestCase {
constructor() {
super(...arguments);
this._APPLICATION_TEMPLATE_WRAPPER = ENV._APPLICATION_TEMPLATE_WRAPPER;
this._TEMPLATE_ONLY_GLIMMER_COMPONENTS = ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS;

ENV._APPLICATION_TEMPLATE_WRAPPER = false;
ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true;

let didCreateReloader = (reloader) => {
Expand Down Expand Up @@ -81,7 +79,6 @@ moduleFor(

teardown() {
super.teardown();
ENV._APPLICATION_TEMPLATE_WRAPPER = this._APPLICATION_TEMPLATE_WRAPPER;
ENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = this._TEMPLATE_ONLY_GLIMMER_COMPONENTS;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { moduleFor, ApplicationTestCase, strip } from 'internal-test-helpers';

import { ENV } from '@ember/-internals/environment';
import Controller from '@ember/controller';
import Route from '@ember/routing/route';
import { service } from '@ember/service';
Expand All @@ -13,29 +12,7 @@ import { runTask } from '../../../../../../internal-test-helpers/lib/run';
moduleFor(
'Application test: rendering',
class extends ApplicationTestCase {
constructor() {
super(...arguments);
this._APPLICATION_TEMPLATE_WRAPPER = ENV._APPLICATION_TEMPLATE_WRAPPER;
}

teardown() {
super.teardown();
ENV._APPLICATION_TEMPLATE_WRAPPER = this._APPLICATION_TEMPLATE_WRAPPER;
}

['@test it can render the application template with a wrapper']() {
ENV._APPLICATION_TEMPLATE_WRAPPER = true;

this.addTemplate('application', 'Hello world!');

return this.visit('/').then(() => {
this.assertComponentElement(this.element, { content: 'Hello world!' });
});
}

['@test it can render the application template without a wrapper']() {
ENV._APPLICATION_TEMPLATE_WRAPPER = false;

this.addTemplate('application', 'Hello world!');

return this.visit('/').then(() => {
Expand Down
5 changes: 0 additions & 5 deletions packages/@ember/application/tests/visit_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Engine from '@ember/engine';
import Route from '@ember/routing/route';
import { Component, helper, isSerializationFirstNode } from '@ember/-internals/glimmer';
import { compile } from 'ember-template-compiler';
import { ENV } from '@ember/-internals/environment';

function expectAsyncError() {
RSVP.off('error');
Expand All @@ -26,7 +25,6 @@ moduleFor(
class extends ApplicationTestCase {
teardown() {
RSVP.on('error', onerrorDefault);
ENV._APPLICATION_TEMPLATE_WRAPPER = false;
super.teardown();
}

Expand All @@ -52,7 +50,6 @@ moduleFor(
rootElement,
};

ENV._APPLICATION_TEMPLATE_WRAPPER = false;
return this.visit('/', bootOptions).then(() => {
assert.equal(
rootElement.innerHTML,
Expand All @@ -75,8 +72,6 @@ moduleFor(
_renderMode: 'serialize',
};

ENV._APPLICATION_TEMPLATE_WRAPPER = false;

return this.visit('/', bootOptions)
.then((instance) => {
assert.ok(
Expand Down
23 changes: 0 additions & 23 deletions packages/ember/tests/routing/toplevel_dom_test.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
import { ENV } from '@ember/-internals/environment';
import { moduleFor, ApplicationTestCase } from 'internal-test-helpers';

moduleFor(
'Top Level DOM Structure',
class extends ApplicationTestCase {
constructor() {
super(...arguments);
this._APPLICATION_TEMPLATE_WRAPPER = ENV._APPLICATION_TEMPLATE_WRAPPER;
}

teardown() {
super.teardown();
ENV._APPLICATION_TEMPLATE_WRAPPER = this._APPLICATION_TEMPLATE_WRAPPER;
}

['@test topmost template with wrapper']() {
ENV._APPLICATION_TEMPLATE_WRAPPER = true;

this.addTemplate('application', 'hello world');

return this.visit('/').then(() => {
this.assertComponentElement(this.element, { content: 'hello world' });
});
}

['@test topmost template without wrapper']() {
ENV._APPLICATION_TEMPLATE_WRAPPER = false;

this.addTemplate('application', 'hello world');

return this.visit('/').then(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { EmberPrecompileOptions } from 'ember-template-compiler';
import { compile } from 'ember-template-compiler';
import { ENV } from '@ember/-internals/environment';
import AbstractTestCase from './abstract';
import { runDestroy, runTask, runLoopSettled } from '../run';
import type { BootOptions } from '@ember/engine/instance';
Expand Down Expand Up @@ -48,9 +47,7 @@ export default abstract class AbstractApplicationTestCase extends AbstractTestCa
return this._element;
}

let element = document.querySelector(
ENV._APPLICATION_TEMPLATE_WRAPPER ? '#qunit-fixture > div.ember-view' : '#qunit-fixture'
);
let element = document.querySelector('#qunit-fixture');

return (this._element = element);
}
Expand Down
1 change: 0 additions & 1 deletion tests/docs/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
'LOG_STACKTRACE_ON_DEPRECATION',
'LOG_VERSION',
'[]',
'_APPLICATION_TEMPLATE_WRAPPER',
'_DEBUG_RENDER_TREE',
'_DEFAULT_ASYNC_OBSERVERS',
'_NO_IMPLICIT_ROUTE_MODEL',
Expand Down
1 change: 0 additions & 1 deletion tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

if (edition === 'octane') {
EmberENV._TEMPLATE_ONLY_GLIMMER_COMPONENTS = true;
EmberENV._APPLICATION_TEMPLATE_WRAPPER = false;
EmberENV._DEFAULT_ASYNC_OBSERVERS = true;
}

Expand Down
26 changes: 7 additions & 19 deletions tests/node/app-boot-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ QUnit.module('App Boot', function (hooks) {
return this.renderToHTML('/').then(function (html) {
assert.htmlMatches(
html,
'<body><div id="EMBER_ID" class="ember-view"><div id="EMBER_ID" class="ember-view"><h1>Hello World</h1><div><div id="EMBER_ID" class="ember-view"><p>The files are *inside* the computer?!</p></div></div></div></div></body>'
'<body><div id="EMBER_ID" class="ember-view"><h1>Hello World</h1><div><div id="EMBER_ID" class="ember-view"><p>The files are *inside* the computer?!</p></div></div></div></body>'
);
});
});
Expand All @@ -50,7 +50,7 @@ QUnit.module('App Boot', function (hooks) {
return this.renderToHTML('/').then(function (html) {
assert.htmlMatches(
html,
'<body><div id="EMBER_ID" class="ember-view"><h1><a id="EMBER_ID" href="/photos" class="ember-view">Go to photos</a></h1></div></body>'
'<body><h1><a id="EMBER_ID" href="/photos" class="ember-view">Go to photos</a></h1></body>'
);
});
});
Expand All @@ -64,7 +64,7 @@ QUnit.module('App Boot', function (hooks) {
return this.renderToHTML('/').then(function (html) {
assert.htmlMatches(
html,
'<body><div id="EMBER_ID" class="ember-view"><h1><a id="EMBER_ID" href="/photos" class="ember-view">Go to photos</a></h1></div></body>'
'<body><h1><a id="EMBER_ID" href="/photos" class="ember-view">Go to photos</a></h1></body>'
);
});
});
Expand All @@ -80,10 +80,7 @@ QUnit.module('App Boot', function (hooks) {
});

return this.renderToHTML('/').then(function (html) {
assert.htmlMatches(
html,
'<body><div id="EMBER_ID" class="ember-view"><h1><b>Hello world</b></h1></div></body>'
);
assert.htmlMatches(html, '<body><h1><b>Hello world</b></h1></body>');
});
});

Expand All @@ -99,19 +96,13 @@ QUnit.module('App Boot', function (hooks) {
let promises = [];
promises.push(
this.renderToHTML('/').then(function (html) {
assert.htmlMatches(
html,
'<body><div id="EMBER_ID" class="ember-view"><p><span>index</span></p></div></body>'
);
assert.htmlMatches(html, '<body><p><span>index</span></p></body>');
})
);

promises.push(
this.renderToHTML('/photos').then(function (html) {
assert.htmlMatches(
html,
'<body><div id="EMBER_ID" class="ember-view"><p><em>photos</em></p></div></body>'
);
assert.htmlMatches(html, '<body><p><em>photos</em></p></body>');
})
);

Expand Down Expand Up @@ -150,10 +141,7 @@ QUnit.module('App Boot', function (hooks) {
this.template('application', "<div {{action 'foo'}}></div>");

return this.renderToHTML('/').then(function (html) {
assert.htmlMatches(
html,
'<body><div id="EMBER_ID" class="ember-view"><div></div></div></body>'
);
assert.htmlMatches(html, '<body><div></div></body>');
});
});
});
1 change: 0 additions & 1 deletion tests/node/fastboot-sandbox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ function buildSandboxContext(precompile) {
`
var EmberENV = {
_TEMPLATE_ONLY_GLIMMER_COMPONENTS: true,
_APPLICATION_TEMPLATE_WRAPPER: false,
_DEFAULT_ASYNC_OBSERVERS: true,
_JQUERY_INTEGRATION: false,
};`,
Expand Down