jashkenas / jashkenas/backbone
After using extend function, the child name is not appropriate
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 28.1k
- Forks
- 5.3k
- PR merge metrics
- No merged PRs in 30d
Description
As in the definition of var extend = function(protoProps, staticProps) ,
`child = function(){ return parent.apply(this, arguments); };`
the return child function's name is set as 'child'.
Thus, any new object created by the child function, when you inspect them in Chrome, the name of constructor is displayed as 'child'.

Would it be better to display the name of constructor using parent constructor's name ?
From my point of view, it gives developers intuitive overview what the object essentially is. In previous case, "Backbone.Collection" should be displayed after todos.

Because

I was using the todo list example http://todomvc.com/examples/backbone/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the extend function definition shown in the issue, especially the child constructor created as `function(){ return parent.apply(this, arguments); }`. Investigate how Backbone's constructor names are exposed in Chrome for objects created through extend; done means the displayed constructor name is more representative of the parent or derived type without breaking existing extend behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100