10 votes
Accepted

Interactive API documentation page of a RESTful dictionary API using Backbone.js

Be consistent with your method naming; don't mix camelCase and snake_case, pick one and stick with it. I would recommend picking ...
user avatar
  • 774
4 votes
Accepted

Backbone.js dynamic table

As this question was asked nearly four years ago it is likely the case that you have learned more about JavaScript since then and/or changed this code. Nonetheless perhaps the info below will help you ...
user avatar
4 votes
Accepted

Simple JavaScript Backbone.Js tool to highlight multiple search terms

One quick note (I'm so sorry I have no chance to read the full code) please be careful when using reference values (i.e object and arrays) in defaults, let me show ...
user avatar
3 votes
Accepted

Clicking child view and preventing parent view from running dblclick event

I'm not sure what seems convoluted to you. It's a simple piece of code, and if you remove anything from it, it will fail to do what you want, as you noted yourself: If you remove the ...
user avatar
  • 108k
2 votes
Accepted

Selectable date filters

jQuery Your code uses jQuery, but you don't seem to be using any features of jQuery that offer any advantages over the DOM - unless you need to target older browsers you can remove your jQuery ...
user avatar
  • 195
2 votes

Selectable date filters

As jQuery is loaded, why not taking advantage of it. This will make the code short. In the OP code, Vanilla JS is used and that object is wrapped in jQuery which is not necessary. Just use jQuery with ...
user avatar
  • 2,956
2 votes

MVC Design using backbone.js

Interesting question, MVC It seems, you did not nail the MVC concept perfectly. In essence, you should have 1 single render routine for both RGB, HSV and CMYK since all these are just outputs of ...
user avatar
  • 32.7k
2 votes

Lazy singleton with BackboneJS

This is not the simplest way. There seems to be no point in instance, if there can be only 1 instance, why have it all ? Why have ...
user avatar
  • 32.7k
1 vote

Unit testing Backbone Model

I'm not really familiar with mocha. If I understand correctly, the true and false values here closely releated, in the sense ...
user avatar
  • 108k
1 vote

Selectable date filters

Good question, there is so much repetition in there, violating the DRY principle. I think the first thing is that you apply a number of things to both date1 and <...
user avatar
  • 32.7k
1 vote

Selectable date filters

1. Combining JQuery Selectors Jquery can select multiple items at once as you can with css selectors. This can cut out some duplication. 2. Using Switches instead of if-else chains Switches are a ...
user avatar
1 vote

Backbone view that "starts" the application

You should shorten this up if (pub_req) { Page.flip('splash'); } else if (!token) { Page.flip('splash'); } else { this.loadViews(token); } by merging ...
user avatar
  • 28.5k
1 vote
Accepted

Shipping calculator consisting of one field

Getting rid of backbone, you can simplify this a lot. HTML ...
user avatar
  • 4,215
1 vote

Backbone subviews and switch

I am glad that you are following conventions. That way is really simple to hack the code in order to shorten it. All you have to do is to create the right View instance and all the remaining code is ...
user avatar
  • 5,536
1 vote

Rendering comments in a Backbone view

From a once over: load_comments should follow lowerCamelCase -> loadComments Avoid ...
user avatar
  • 32.7k
1 vote
Accepted

Secret Santa Application : Practical Interview Test

If I was evaluating this code as a sample for an interview, I might be deterred by the inconsistent indentation - some blocks are indented with two spaces while others have four spaces. I do like the ...
user avatar
1 vote

Managing collection views, adding/removing views, and listening for events

I think there is a lot of duplication in your code: App.Collections.Movies and App.Collections.Watchlist have the exact same ...
user avatar
  • 181
1 vote
Accepted

Menu visibility toggle method

You already mentioned the duplication, so let's address that issue. First, I'd move the assignment to a common block so it's clear that you're toggling the visibility. Then for toggling the CSS ...
user avatar
  • 11k
1 vote

Getting the first selected item from a list of Backbone models

I assume you want to return the first model from an array of models. Since you're using Backbone, you'll be able to use Underscore. So, if first model has length, return it: function getItems() { ...
user avatar
  • 41
1 vote
Accepted

Concisely handling both arrays and Backbone.Collection as parameter

setFromSongs initialises the searchResults variable and then in 2-of-3 cases it immediately overwrites it. You can rewrite the ...
user avatar
  • 904
1 vote

Validating a model and focus to the element if validation fails

I'm not very familiar with Backbone, however I do have a couple of comments: To simplify your life, check out Marionette Forms. It can handle quick validation of forms. This is an alternative to ...
user avatar
  • 5,717

Only top scored, non community-wiki answers of a minimum length are eligible