From 1afce81bd0f985ff22742f6ec656e18ffdfa55bd Mon Sep 17 00:00:00 2001 From: cibernox Date: Mon, 11 Dec 2017 23:38:53 +0100 Subject: [PATCH 1/7] Remove Application wrapper div --- text/0000-remove-application-wrapper.md | 99 +++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 text/0000-remove-application-wrapper.md diff --git a/text/0000-remove-application-wrapper.md b/text/0000-remove-application-wrapper.md new file mode 100644 index 0000000000..4d23881d57 --- /dev/null +++ b/text/0000-remove-application-wrapper.md @@ -0,0 +1,99 @@ +- Start Date: 2017-12-11 +- RFC PR: https://github.com/emberjs/rfcs/pull/280 +- Ember Issue: (leave this empty) + +# Summary + +Introduce a low-level "flag" to remove the automatic wrapper `
` around +Ember apps and tests. + +# Motivation + +In Ember applications today, applications are anchored to some existing html +element in the page. Usually, this element is the `` of the document, but it +can be configured to be a different one when the application is defined, +passing a CSS selector to the `rootElement` property: + +```js +export default Ember.Application.extend({ + rootElement: '#app' +}); +``` + +However, whatever the root is, the application adds another `
` wrapper +that it's not requited anymore. It's just a vestigial reminder of some implementation +detail of how views worked in Ember 1.x. Some sort of wisdom tooth of the original +rendering system that it serves no purpose today. + +Furthermore, much like a wisdom tooth, it can gives us problems. In the past this element +was configurable using the `ApplicationView`, but when views were removed we lost that +ability. Right now we are stuck with a wrapper element we can't remove and we also can't +customize, which is why some apps target the selector `body > .ember-view` to style this +element. + +Similarly, in testing there is another `.ember-view` wrapper inside the +`#ember-testing` container for no good reason. + +This RFC proposes to add a global flag to remove those wrapper elements, +effectively making the `application.hbs` template have "Outer HTML" semantics, which aligns +well with [the changes proposed recently](#278) for template-only components and the way glimmer +apps work. + +The same flag will also remove the unnecessary extra wrapper inside the testing +container. + +# Detailed design + +## API Surface + +The proposed approach is identical to the one proposed in #278, that I reproduce +pristine below in italic: + +*We should not expose the flag directly as a public API. Instead, we should +abstract the flag with a "privileged addon" whose only purpose is to enable +the flag. Applications will enable the flag by installing this addon. This +will allow for more flexibility in changing the flag's implementation (the +location, naming, value, or even the existence of it) in the future. From the +user's perspective, it is the addon that provides this functionality. The +flag is simply an internal implementation detail.* + +*We have done this before in other cases (such as the legacy view addon during +the 2.0 transition period), and it has generally worked well.* + +*When landing this feature, it will be entirely opt-in for existing apps, but +the Ember CLI application blueprint should be updated to include the addon by +default. At a later time, we should provide another addon that _disables_ the +flag explicitly (installing both addons would be an install-time error). At +that time, we will issue a deprecation warning if the flag is *not set*, with +a message that directs the user to install one of the two addons.* + +## Migration Path + +Given that this change only affects one single point in your application, +I do not believe we need any specific strategy. If the users want to bring +back the wrapper because it breaks their styles or some other reason, +they can just add it manually on the `application.hbs` template, with +any class or id they want. + +# How We Teach This + +This addon will be an opt in, but at some point it will become part of +the default blueprint. This change, rather than introducing a new concept, it *removes* +an old one. Users won't have to google what is the way to remove or customize +the implicit application wrapper of the app (to sadly discover that is not +even possible), but instead they will just add a wrapper only if they want, +and in the same way they would add a wrapper in any other point of their application, +with regular handlebars. + +# Drawbacks + +There is a possibility that removing the wrapper can break styles for some apps, +but since adding the wrapper back is just of editing the `application.hbs` template, +that is probably a despicable drawback. + +There is also a non-zero chance that some testing addon is relying on the `#ember-testing > .ember-view` +html hierarchy for some reason, and those addons would have to be updated. + +# Alternatives + +Leave things as they are today. \ No newline at end of file From 917cf9a070510fa642b44765a7eec36645673e9a Mon Sep 17 00:00:00 2001 From: cibernox Date: Tue, 12 Dec 2017 00:11:06 +0100 Subject: [PATCH 2/7] Fix typo --- text/0000-remove-application-wrapper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-remove-application-wrapper.md b/text/0000-remove-application-wrapper.md index 4d23881d57..2fdbccea96 100644 --- a/text/0000-remove-application-wrapper.md +++ b/text/0000-remove-application-wrapper.md @@ -21,7 +21,7 @@ export default Ember.Application.extend({ ``` However, whatever the root is, the application adds another `
` wrapper -that it's not requited anymore. It's just a vestigial reminder of some implementation +that it's not required anymore. It's just a vestigial reminder of some implementation detail of how views worked in Ember 1.x. Some sort of wisdom tooth of the original rendering system that it serves no purpose today. From 9b395e49bf8ca094785fc449a4279cc2ba9fc513 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 11 Dec 2017 23:22:57 -0700 Subject: [PATCH 3/7] Fixing small grammatical glitches --- text/0000-remove-application-wrapper.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/text/0000-remove-application-wrapper.md b/text/0000-remove-application-wrapper.md index 2fdbccea96..acead4f4c2 100644 --- a/text/0000-remove-application-wrapper.md +++ b/text/0000-remove-application-wrapper.md @@ -21,11 +21,11 @@ export default Ember.Application.extend({ ``` However, whatever the root is, the application adds another `
` wrapper -that it's not required anymore. It's just a vestigial reminder of some implementation +that it's not required anymore. It's just a vestigial remainder of some implementation detail of how views worked in Ember 1.x. Some sort of wisdom tooth of the original -rendering system that it serves no purpose today. +rendering system that serves no purpose today. -Furthermore, much like a wisdom tooth, it can gives us problems. In the past this element +Furthermore, much like a wisdom tooth, it can give us problems. In the past, this element was configurable using the `ApplicationView`, but when views were removed we lost that ability. Right now we are stuck with a wrapper element we can't remove and we also can't customize, which is why some apps target the selector `body > .ember-view` to style this @@ -47,7 +47,7 @@ container. ## API Surface The proposed approach is identical to the one proposed in #278, that I reproduce -pristine below in italic: +pristine below in italics: *We should not expose the flag directly as a public API. Instead, we should abstract the flag with a "privileged addon" whose only purpose is to enable @@ -78,7 +78,7 @@ any class or id they want. # How We Teach This This addon will be an opt in, but at some point it will become part of -the default blueprint. This change, rather than introducing a new concept, it *removes* +the default blueprint. This change, rather than introducing a new concept, *removes* an old one. Users won't have to google what is the way to remove or customize the implicit application wrapper of the app (to sadly discover that is not even possible), but instead they will just add a wrapper only if they want, @@ -96,4 +96,4 @@ html hierarchy for some reason, and those addons would have to be updated. # Alternatives -Leave things as they are today. \ No newline at end of file +Leave things as they are today. From 56b08d5a6a6aa8306aeb794a1cfade628d8f40e5 Mon Sep 17 00:00:00 2001 From: cibernox Date: Tue, 12 Dec 2017 12:43:02 +0100 Subject: [PATCH 4/7] Despicable => Minor --- text/0000-remove-application-wrapper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-remove-application-wrapper.md b/text/0000-remove-application-wrapper.md index acead4f4c2..1d584c3af0 100644 --- a/text/0000-remove-application-wrapper.md +++ b/text/0000-remove-application-wrapper.md @@ -89,7 +89,7 @@ with regular handlebars. There is a possibility that removing the wrapper can break styles for some apps, but since adding the wrapper back is just of editing the `application.hbs` template, -that is probably a despicable drawback. +that is probably a minor drawback. There is also a non-zero chance that some testing addon is relying on the `#ember-testing > .ember-view` html hierarchy for some reason, and those addons would have to be updated. From 2e3a980d6b8b964ee066304f2f2344eb3ed54d2c Mon Sep 17 00:00:00 2001 From: Ricardo Mendes Date: Tue, 12 Dec 2017 11:49:10 +0000 Subject: [PATCH 5/7] Update 0000-remove-application-wrapper.md --- text/0000-remove-application-wrapper.md | 38 ++++++++++++------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/text/0000-remove-application-wrapper.md b/text/0000-remove-application-wrapper.md index 1d584c3af0..cf1c17c183 100644 --- a/text/0000-remove-application-wrapper.md +++ b/text/0000-remove-application-wrapper.md @@ -9,7 +9,7 @@ Ember apps and tests. # Motivation -In Ember applications today, applications are anchored to some existing html +In Ember applications today, applications are anchored to some existing HTML element in the page. Usually, this element is the `` of the document, but it can be configured to be a different one when the application is defined, passing a CSS selector to the `rootElement` property: @@ -21,23 +21,22 @@ export default Ember.Application.extend({ ``` However, whatever the root is, the application adds another `
` wrapper -that it's not required anymore. It's just a vestigial remainder of some implementation +that is not required anymore. It's a vestigial remainder of some implementation detail of how views worked in Ember 1.x. Some sort of wisdom tooth of the original rendering system that serves no purpose today. Furthermore, much like a wisdom tooth, it can give us problems. In the past, this element was configurable using the `ApplicationView`, but when views were removed we lost that -ability. Right now we are stuck with a wrapper element we can't remove and we also can't -customize, which is why some apps target the selector `body > .ember-view` to style this -element. +ability. Right now we are stuck with a wrapper element we can't remove nor customize, +which is why some apps target the selector `body > .ember-view` to style this element. Similarly, in testing there is another `.ember-view` wrapper inside the `#ember-testing` container for no good reason. This RFC proposes to add a global flag to remove those wrapper elements, effectively making the `application.hbs` template have "Outer HTML" semantics, which aligns -well with [the changes proposed recently](#278) for template-only components and the way glimmer -apps work. +well with [the changes recently proposed](#278) for template-only components, +as well as the way Glimmer apps work. The same flag will also remove the unnecessary extra wrapper inside the testing container. @@ -46,26 +45,25 @@ container. ## API Surface -The proposed approach is identical to the one proposed in #278, that I reproduce -pristine below in italics: +The proposed approach is identical to the one proposed in #278, quoted below: -*We should not expose the flag directly as a public API. Instead, we should +> We should not expose the flag directly as a public API. Instead, we should abstract the flag with a "privileged addon" whose only purpose is to enable the flag. Applications will enable the flag by installing this addon. This will allow for more flexibility in changing the flag's implementation (the location, naming, value, or even the existence of it) in the future. From the user's perspective, it is the addon that provides this functionality. The -flag is simply an internal implementation detail.* +flag is simply an internal implementation detail. -*We have done this before in other cases (such as the legacy view addon during -the 2.0 transition period), and it has generally worked well.* +> We have done this before in other cases (such as the legacy view addon during +the 2.0 transition period), and it has generally worked well. -*When landing this feature, it will be entirely opt-in for existing apps, but +> When landing this feature, it will be entirely opt-in for existing apps, but the Ember CLI application blueprint should be updated to include the addon by default. At a later time, we should provide another addon that _disables_ the flag explicitly (installing both addons would be an install-time error). At that time, we will issue a deprecation warning if the flag is *not set*, with -a message that directs the user to install one of the two addons.* +a message that directs the user to install one of the two addons. ## Migration Path @@ -77,22 +75,22 @@ any class or id they want. # How We Teach This -This addon will be an opt in, but at some point it will become part of +This addon will be opt-in, but at some point it will become part of the default blueprint. This change, rather than introducing a new concept, *removes* an old one. Users won't have to google what is the way to remove or customize the implicit application wrapper of the app (to sadly discover that is not -even possible), but instead they will just add a wrapper only if they want, +even possible), but instead they will add a wrapper only if they want, and in the same way they would add a wrapper in any other point of their application, -with regular handlebars. +with regular Handlebars. # Drawbacks There is a possibility that removing the wrapper can break styles for some apps, -but since adding the wrapper back is just of editing the `application.hbs` template, +but since adding the wrapper back is just editing the `application.hbs` template, that is probably a minor drawback. There is also a non-zero chance that some testing addon is relying on the `#ember-testing > .ember-view` -html hierarchy for some reason, and those addons would have to be updated. +HTML hierarchy for some reason, and those addons would have to be updated. # Alternatives From 03e7195ab65d15a80d8fa8f8dcc1f5dc2c26ede4 Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Thu, 21 Dec 2017 23:41:33 -0800 Subject: [PATCH 6/7] Fix link --- text/0000-remove-application-wrapper.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/text/0000-remove-application-wrapper.md b/text/0000-remove-application-wrapper.md index cf1c17c183..df5cee5009 100644 --- a/text/0000-remove-application-wrapper.md +++ b/text/0000-remove-application-wrapper.md @@ -35,8 +35,8 @@ Similarly, in testing there is another `.ember-view` wrapper inside the This RFC proposes to add a global flag to remove those wrapper elements, effectively making the `application.hbs` template have "Outer HTML" semantics, which aligns -well with [the changes recently proposed](#278) for template-only components, -as well as the way Glimmer apps work. +well with [the changes recently proposed](https://github.com/emberjs/rfcs/pull/278) +for template-only components, as well as the way Glimmer apps work. The same flag will also remove the unnecessary extra wrapper inside the testing container. From 86c77a469fed33ee61f9359300774c7791a6f5ba Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Wed, 3 Jan 2018 10:04:20 -0800 Subject: [PATCH 7/7] Add ember PR link --- text/0000-remove-application-wrapper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-remove-application-wrapper.md b/text/0000-remove-application-wrapper.md index df5cee5009..f1e89021e8 100644 --- a/text/0000-remove-application-wrapper.md +++ b/text/0000-remove-application-wrapper.md @@ -1,6 +1,6 @@ - Start Date: 2017-12-11 - RFC PR: https://github.com/emberjs/rfcs/pull/280 -- Ember Issue: (leave this empty) +- Ember Issue: https://github.com/emberjs/ember.js/pull/15981 # Summary