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

Marionette 2.0 - getChildView doesn't use the child object it is passed #1567

Closed
MeoMix opened this issue Jul 3, 2014 · 4 comments
Closed

Comments

@MeoMix
Copy link
Member

MeoMix commented Jul 3, 2014

    getChildView: function (child) {
        var childView = this.getOption('childView') || this.constructor;

        if (!childView) {
            throwError('A "childView" must be specified', 'NoChildViewError');
        }

        return childView;
    },

Line 2226

and

   getChildView: function (child) {
        var childView = this.getOption('childView');

        if (!childView) {
            throwError('A "childView" must be specified', 'NoChildViewError');
        }

        return childView;
    },

line 1953

@samccone samccone added the bug label Jul 3, 2014
@samccone samccone added this to the v2.0.2 milestone Jul 8, 2014
@cmaher
Copy link
Member

cmaher commented Jul 9, 2014

I think this is to demonstrate that subclasses can use the provided to determine what kind of view should be returned. from the docs

I'm not finding any tests for this behavior, but I'm thinking they should be added.

@cmaher
Copy link
Member

cmaher commented Jul 9, 2014

That said, the same reasoning in #1566 applies here too.

@samccone
Copy link
Member

The fix for these is to add Documentation around why the argument is there.

@samccone samccone removed this from the v2.0.2 milestone Jul 10, 2014
cmaher added a commit to cmaher/backbone.marionette that referenced this issue Jul 13, 2014
cmaher added a commit to cmaher/backbone.marionette that referenced this issue Jul 13, 2014
@jamesplease
Copy link
Member

The fix for these is to add Documentation around why the argument is there.

Agree with @samccone.

A good number of Backbone and Marionette methods are passed arguments they don't need. This is sometimes intentional, other times not. The time's its intentional is because users will want to override methods to add new, or different functionality, so we give them the information that they need to do that.

The cases we don't need it are when you can just as easily access the property on this within the method.

So if this passed this.collection along as an argument, that would make no sense. But since it's passing a specific model in the collection this becomes rurl useful to people trying to customize the method on a per-model basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants