Modify ↓
Ticket #10615 (closed bug: patchwelcome)
Consistency and concision
| Reported by: | anonymous | Owned by: | rwaldron |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | core | Version: | 1.7b2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Towards the very beginning we have:
// Save a reference to some core methods toString = Object.prototype.toString, hasOwn = Object.prototype.hasOwnProperty, push = Array.prototype.push, slice = Array.prototype.slice, trim = String.prototype.trim, indexOf = Array.prototype.indexOf,
and then we have:
push: push, sort: [].sort, splice: [].splice
Why not be more consistent and concise by writing the first part
// Save a reference to some core methods
toString = {}.toString,
hasOwn = {}.hasOwnProperty,
push = [].push,
slice = [].slice,
trim = ''.trim,
indexOf = [].indexOf,
Change History
comment:1 Changed 19 months ago by rwaldron
- Owner set to rwaldron
- Priority changed from undecided to low
- Status changed from new to assigned
- Component changed from unfiled to core
- Milestone changed from None to 1.next
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Using the literal notation is slower then Constructor.prototype.