Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate renderToElement #14482

Merged
merged 1 commit into from
Nov 13, 2016
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
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