Skip to content

Commit

Permalink
Merge pull request #14482 from josemarluedke/depecate-render-to-element
Browse files Browse the repository at this point in the history
Deprecate renderToElement
  • Loading branch information
rwjblue authored Nov 13, 2016
2 parents ec6ad8f + 67d116e commit 02d36cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ moduleFor('appendTo: with multiple components', class extends AbstractAppendTest
moduleFor('renderToElement: no arguments (defaults to a body context)', class extends AbstractAppendTest {

append(component) {
expectDeprecation(/Using the `renderToElement` is deprecated in favor of `appendTo`. Called in/);
let wrapper;

this.runTask(() => wrapper = component.renderToElement());
Expand All @@ -652,6 +653,7 @@ moduleFor('renderToElement: no arguments (defaults to a body context)', class ex
moduleFor('renderToElement: a div', class extends AbstractAppendTest {

append(component) {
expectDeprecation(/Using the `renderToElement` is deprecated in favor of `appendTo`. Called in/);
let wrapper;

this.runTask(() => wrapper = component.renderToElement('div'));
Expand Down
11 changes: 11 additions & 0 deletions packages/ember-views/lib/mixins/view_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,22 @@ export default Mixin.create({
@method renderToElement
@param {String} tagName The tag of the element to create and render into. Defaults to "body".
@return {HTMLBodyElement} element
@deprecated Use appendTo instead.
@private
*/
renderToElement(tagName) {
tagName = tagName || 'body';

deprecate(
`Using the \`renderToElement\` is deprecated in favor of \`appendTo\`. Called in ${this.toString()}`,
false,
{
id: 'ember-views.render-to-element',
until: '2.12.0',
url: 'http://emberjs.com/deprecations/v2.x#toc_code-rendertoelement-code'
}
);

let element = this.renderer.createElement(tagName);

this.renderer.appendTo(this, element);
Expand Down

0 comments on commit 02d36cb

Please sign in to comment.