mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-06-15 01:49:05 +08:00
`for in` is much faster than `Object.keys()` but `for in` includes properties from the prototype. http://jsperf.com/for-in-vs-object-keys2 All the uses of shallowCopy don't deal with objects with heavy prototypes, except for Attributes instances in $compile. For this reason it's better to special-case Attributes constructor and make it do it's own shallow copy. This cleans up the Attribute/$compile code as well.