From 07688a685ec4ad3fbc4df4b43ca06e973a8432f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 28 Nov 2012 22:08:56 -0800 Subject: [PATCH] Switch back from using 'x' in obj to obj.x != null in basic type constructors, since 'x' in would throw an exception. --- src/basic/Point.js | 6 +++--- src/basic/Rectangle.js | 2 +- src/basic/Size.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/basic/Point.js b/src/basic/Point.js index 02e6203c..de3b5b1c 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -148,13 +148,13 @@ var Point = this.Point = Base.extend(/** @lends Point# */{ if (Array.isArray(arg0)) { this.x = arg0[0]; this.y = arg0.length > 1 ? arg0[1] : arg0[0]; - } else if ('x' in arg0) { + } else if (arg0.x != null) { this.x = arg0.x; this.y = arg0.y; - } else if ('width' in arg0) { + } else if (arg0.width != null) { this.x = arg0.width; this.y = arg0.height; - } else if ('angle' in arg0) { + } else if (arg0.angle != null) { this.x = arg0.length; this.y = 0; this.setAngle(arg0.angle); diff --git a/src/basic/Rectangle.js b/src/basic/Rectangle.js index 183a1df8..1621a8c1 100644 --- a/src/basic/Rectangle.js +++ b/src/basic/Rectangle.js @@ -71,7 +71,7 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{ this.x = this.y = this.width = this.height = 0; if (this._read) this._read = arg0 === null ? 1 : 0; - } else if (arguments.length > 1 && !('width' in arg0)) { + } else if (arguments.length > 1 && arg0.width == null) { // We're checking arg0.width to rule out Rectangles, which are // handled separately below. // Read a point argument and look at the next value to see wether diff --git a/src/basic/Size.js b/src/basic/Size.js index dd3a3c7a..e0e3c282 100644 --- a/src/basic/Size.js +++ b/src/basic/Size.js @@ -109,10 +109,10 @@ var Size = this.Size = Base.extend(/** @lends Size# */{ if (Array.isArray(arg0)) { this.width = arg0[0]; this.height = arg0.length > 1 ? arg0[1] : arg0[0]; - } else if ('width' in arg0) { + } else if (arg0.width != null) { this.width = arg0.width; this.height = arg0.height; - } else if ('x' in arg0) { + } else if (arg0.x != null) { this.width = arg0.x; this.height = arg0.y; } else {