Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Proposed clarification in documentation: #1004

Merged
merged 2 commits into from

3 participants

@peterp

Accounts.reset(<%= ... %>) to accounts.reset(<%= ... %>)
Projects.reset(<%= ... %>) to projects.reset(<%= ... %>)

As it's popular in JavaScript to capitalize constructors it might be confusing in this context.

@braddunbar
Collaborator

:+1:

@jashkenas
Owner

I dunno -- maybe I'm just old fashioned, but I like to have capitals for my top-level objects...

If we make this documentation change, does this PR cover all of the places where we use caps for non-constructors?

@braddunbar
Collaborator

I see, Accounts is capitalized because it's a global. In that case, perhaps we should just ensure that it's clear Accounts is a collection instance and not a constructor.

var Accounts = new Backbone.Collection();
Accounts.reset(<%= ... %>);
@peterp

I'll go through the documentation to make sure,

  • or -

The documentation could also create the collection to avoid any possible confusion:

var Accounts = new Collection();
Accounts.reset(<% ... %>);

@braddunbar
Collaborator

For what it's worth, there is some precedent here.

@jashkenas
Owner

Let's go that way then. Also, no need for parens when new-ing a value without params.

var Accounts = new Backbone.Collection;
@peterp peterp referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Peter Pistorius and others added some commits
Peter Pistorius Changed:
`Accounts.reset(<%= ... %>)` to `accounts.reset(<%= ... %>)`
`Projects.reset(<%= ... %>)` to `projects.reset(<%= ... %>)`

As it's popular in JavaScript to capitalize constructors it might be confusing in this context.
742dde3
@peterp peterp fixes #1004 c4d53ab
@braddunbar braddunbar merged commit cf93180 into jashkenas:master
@braddunbar
Collaborator

Thanks @peterp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 14, 2012
  1. @peterp

    Changed:

    Peter Pistorius authored peterp committed
    `Accounts.reset(<%= ... %>)` to `accounts.reset(<%= ... %>)`
    `Projects.reset(<%= ... %>)` to `projects.reset(<%= ... %>)`
    
    As it's popular in JavaScript to capitalize constructors it might be confusing in this context.
  2. @peterp

    fixes #1004

    peterp authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0  index.html
View
3  index.html
@@ -1597,6 +1597,7 @@ <h2 id="Collection">Backbone.Collection</h2>
<pre>
&lt;script&gt;
+ var Accounts = new Backbone.Collection;
Accounts.reset(&lt;%= @accounts.to_json %&gt;);
&lt;/script&gt;
</pre>
@@ -3054,7 +3055,9 @@ <h2 id="faq">F.A.Q.</h2>
<pre>
&lt;script&gt;
+ var Accounts = new Backbone.Collection;
Accounts.reset(&lt;%= @accounts.to_json %&gt;);
+ var Projects = new Backbone.Collection;
Projects.reset(&lt;%= @projects.to_json(:collaborators => true) %&gt;);
&lt;/script&gt;
</pre>
Something went wrong with that request. Please try again.