From 8b1a840b42fd67192527efca6c89c5c8c875a8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 5 Nov 2015 09:19:55 -0500 Subject: [PATCH 1/2] Resizable: Don't use CSS shorthand properties with `.css()` Fixes #7766 --- ui/widgets/resizable.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index 05ad7209964..daccef93e30 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -100,6 +100,7 @@ $.widget( "ui.resizable", $.ui.mouse, { _create: function() { var n, i, handle, axis, hname, + marginTop, marginRight, marginBottom, marginLeft, that = this, o = this.options; this._addClass( "ui-resizable" ); @@ -131,11 +132,16 @@ $.widget( "ui.resizable", $.ui.mouse, { this.elementIsWrapper = true; + marginTop = this.originalElement.css( "marginTop" ); + marginRight = this.originalElement.css( "marginRight" ); + marginBottom = this.originalElement.css( "marginBottom" ); + marginLeft = this.originalElement.css( "marginLeft" ); + this.element.css( { - marginLeft: this.originalElement.css( "marginLeft" ), - marginTop: this.originalElement.css( "marginTop" ), - marginRight: this.originalElement.css( "marginRight" ), - marginBottom: this.originalElement.css( "marginBottom" ) + marginLeft: marginLeft, + marginTop: marginTop, + marginRight: marginRight, + marginBottom: marginBottom } ); this.originalElement.css( { marginLeft: 0, @@ -157,7 +163,12 @@ $.widget( "ui.resizable", $.ui.mouse, { // Support: IE9 // avoid IE jump (hard set the margin) - this.originalElement.css( { margin: this.originalElement.css( "margin" ) } ); + this.originalElement.css( { + marginTop: marginTop, + marginRight: marginRight, + marginBottom: marginBottom, + marginLeft: marginLeft + } ); this._proportionallyResize(); } From 25a5a39ba3376146c505a8f20db1122b20956d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 5 Nov 2015 10:58:58 -0500 Subject: [PATCH 2/2] fixup: Simplify based on Dave's feedback --- ui/widgets/resizable.js | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index daccef93e30..da704de4b76 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -99,8 +99,7 @@ $.widget( "ui.resizable", $.ui.mouse, { _create: function() { - var n, i, handle, axis, hname, - marginTop, marginRight, marginBottom, marginLeft, + var n, i, handle, axis, hname, margins, that = this, o = this.options; this._addClass( "ui-resizable" ); @@ -132,23 +131,15 @@ $.widget( "ui.resizable", $.ui.mouse, { this.elementIsWrapper = true; - marginTop = this.originalElement.css( "marginTop" ); - marginRight = this.originalElement.css( "marginRight" ); - marginBottom = this.originalElement.css( "marginBottom" ); - marginLeft = this.originalElement.css( "marginLeft" ); + margins = { + marginTop: this.originalElement.css( "marginTop" ), + marginRight: this.originalElement.css( "marginRight" ), + marginBottom: this.originalElement.css( "marginBottom" ), + marginLeft: this.originalElement.css( "marginLeft" ) + }; - this.element.css( { - marginLeft: marginLeft, - marginTop: marginTop, - marginRight: marginRight, - marginBottom: marginBottom - } ); - this.originalElement.css( { - marginLeft: 0, - marginTop: 0, - marginRight: 0, - marginBottom: 0 - } ); + this.element.css( margins ); + this.originalElement.css( "margin", 0 ); // support: Safari // Prevent Safari textarea resize @@ -163,12 +154,7 @@ $.widget( "ui.resizable", $.ui.mouse, { // Support: IE9 // avoid IE jump (hard set the margin) - this.originalElement.css( { - marginTop: marginTop, - marginRight: marginRight, - marginBottom: marginBottom, - marginLeft: marginLeft - } ); + this.originalElement.css( margins ); this._proportionallyResize(); }