Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Always return 'this' from Thorax.View.render(). #312

Merged
merged 2 commits into from
Feb 5, 2014

Conversation

ryan-roemer
Copy link
Contributor

Backbone's view.render() says:

    // **render** is the core function that your view should override, in order
    // to populate its element (`this.el`), with the appropriate HTML. The
    // convention is for **render** to always return `this`.
    render: function() {
      return this;
    },

However, Thorax.View.render() returns undefined if there is no view.el and the output parameter passed to render() in the other case. This PR switches both cases to return this per the Backbone way.

Note: This is technically a breaking change for anyone who relied on output being passed pack in a chain of some sort. I believe that behavior is completely undocumented, but I'm not sure what the expectations are in that regard.

/cc @kpdecker @eastridge

@eastridge
Copy link
Contributor

@kpdecker I'm ok with this on WWW side and core library. Does this work for you in mobile land or do you want me to run unit tests? Do you have a regression testing strategy beyond that in place for a branch like this that is more formal?

@kpdecker
Copy link
Contributor

kpdecker commented Feb 5, 2014

I think our return value strategy was a bit screwy to begin with so this is a "bug fix" but lets hold off on releasing it immediately. If this is released in 3.0 vs. 2.x.x then all the better for breaking concerns.

kpdecker added a commit that referenced this pull request Feb 5, 2014
Always return 'this' from Thorax.View.render().
@kpdecker kpdecker merged commit 426d170 into master Feb 5, 2014
@kpdecker kpdecker deleted the render-returns-this branch February 5, 2014 16:11
@kpdecker
Copy link
Contributor

Released in 2.3.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants