0
@@ -49,7 +49,7 @@ var jQuery = function( selector, context ) {
0
// Save a reference to some core methods
0
toString = Object.prototype.toString,
0
- hasOwn
Property = Object.prototype.hasOwnProperty,
0
+ hasOwn
= Object.prototype.hasOwnProperty,
0
push = Array.prototype.push,
0
slice = Array.prototype.slice,
0
indexOf = Array.prototype.indexOf;
0
@@ -450,9 +450,9 @@ jQuery.extend({
0
// Not own constructor property must be Object
0
- && !hasOwnProperty.call(obj, "constructor")
0
- && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) {
0
+ if ( obj.constructor &&
0
+ !hasOwn.call(obj, "constructor") &&
0
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
0
@@ -462,7 +462,7 @@ jQuery.extend({
0
- return key === undefined || hasOwn
Property.call( obj, key );
0
+ return key === undefined || hasOwn
.call( obj, key );
0
isEmptyObject: function( obj ) {
0
@@ -803,5 +803,5 @@ function access( elems, key, value, exec, fn, pass ) {
0
- return (new Date
).getTime();
0
+ return (new Date
()).getTime();
In reference to 806, what's wrong with
+new Date()?@James: Nothing in particular (in that it works) but I've balked against it in the past because it's particularly "magical" and not always obvious what it's doing to someone who may be reading the source - whereas (new Date()).getTime() is very explicit and very obvious as to what the result is.
Fair point. I'm surprised closure compiler doesn't switch
new Date().getTime()for+new Date...Nothing magical about it. ECMA 5th Ed.
Page 169, Section 15.9.3.1 [[PrimitiveValue]]makes it pretty clear.(new Date).valueOf();would also do :P@jdalton: To someone that reads specifications for fun, of course there's "Nothing magical about it." - but it's undeniable that it's much more obtuse than just doing a straight
(new Date()).getTime();or(new Date()).valueOf();.Hehe, I hear @kangax is getting a tramp stamp that reads
"strict";*erm
"use strict";, humor fail :DWhy not use +new Date() and then include a comment. You know, one of those new-fangled thingamawhatsits often included in source code just like this that explains to the uneducated developer what that particular bit of magic does?
Comments are verboten.
On a serious note, it's a popular idea that code should be clear - that if a piece of code needs comments to explain what it does, then that piece of code should be rewritten no longer to need comments.
Appropriate optimizations are exceptions to this rule, as are such things as high-level descriptions of algorithms and data structures, high-level descriptions of design and architecture, examples of how to invoke the code, key assumptions and contexts, etc.