#10615 closed bug (patchwelcome)
Consistency and concision
Reported by: | anonymous | Owned by: | Rick Waldron |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | core | Version: | 1.7b2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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 (3)
comment:1 Changed 11 years ago by
Component: | unfiled → core |
---|---|
Milestone: | None → 1.next |
Owner: | set to Rick Waldron |
Priority: | undecided → low |
Status: | new → assigned |
comment:2 Changed 11 years ago by
Aha. In that case we should maybe always use Constructor.prototype...
comment:3 Changed 11 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | assigned → closed |
Trying a number of different combinations for caching references, all seem to increase the gzipped size of the lib. Closing as "patchwelcome"
Note: See
TracTickets for help on using
tickets.
Using the literal notation is slower then
Constructor.prototype
.