From 263d07894493aafcdc6a565f9f9c079b4b8f5d80 Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Mon, 12 Aug 2013 19:31:39 -0400 Subject: Draggable: Ignore scroll offsets for abspos draggables. Fixes #9315 - Draggable: jumps down with offset of scrollbar --- ui/jquery.ui.draggable.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index ab1e800cd..2bdc20255 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -452,7 +452,12 @@ $.widget("ui.draggable", $.ui.mouse, { var mod = d === "absolute" ? 1 : -1, document = this.document[ 0 ], - scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent; + useOffsetParent = this.cssPosition === "absolute" && ( this.scrollParent[ 0 ] === document || !$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ), + scroll = useOffsetParent ? this.offsetParent : this.scrollParent, + // we need to test if offsetParent was used here because Blink incorrectly reports a 0 scrollTop + // on document.documentElement when the page is scrolled. Checking for offsetParent normalizes + // this across browsers. Blink bug: https://code.google.com/p/chromium/issues/detail?id=157855 + scrollIsRootNode = useOffsetParent && ( /(html|body)/i ).test( scroll[ 0 ].nodeName ); //Cache the scroll if (!this.offset.scroll) { @@ -464,13 +469,13 @@ $.widget("ui.draggable", $.ui.mouse, { pos.top + // The absolute mouse position this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) * mod ) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod) ), left: ( pos.left + // The absolute mouse position this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) - ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) * mod ) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : this.offset.scroll.left ) * mod) ) }; @@ -481,7 +486,12 @@ $.widget("ui.draggable", $.ui.mouse, { var containment, co, top, left, o = this.options, document = this.document[ 0 ], - scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent, + useOffsetParent = this.cssPosition === "absolute" && ( this.scrollParent[ 0 ] === document || !$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ), + scroll = useOffsetParent ? this.offsetParent : this.scrollParent, + // we need to test if offsetParent was used here because Blink incorrectly reports a 0 scrollTop + // on document.documentElement when the page is scrolled. Checking for offsetParent normalizes + // this across browsers. Blink bug: https://code.google.com/p/chromium/issues/detail?id=157855 + scrollIsRootNode = useOffsetParent && ( /(html|body)/i ).test( scroll[ 0 ].nodeName ), pageX = event.pageX, pageY = event.pageY; @@ -542,14 +552,14 @@ $.widget("ui.draggable", $.ui.mouse, { this.offset.click.top - // Click offset (relative to the element) this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top + // The offsetParent's offset without borders (offset + border) - ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) + ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) ), left: ( pageX - // The absolute mouse position this.offset.click.left - // Click offset (relative to the element) this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left + // The offsetParent's offset without borders (offset + border) - ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) + ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) ) }; -- cgit v1.2.3 From e628d0e4ba89eecee2c9b0d4cfb214523cad2ab4 Mon Sep 17 00:00:00 2001 From: Scott González Date: Thu, 15 Aug 2013 16:56:49 -0400 Subject: Dialog: Capitalize default value for closeText option. Fixes #9500 - Dialog: Capitalize 'close' for closeText option. --- tests/unit/dialog/dialog_common.js | 2 +- tests/unit/dialog/dialog_options.js | 2 +- ui/jquery.ui.dialog.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/tests/unit/dialog/dialog_common.js b/tests/unit/dialog/dialog_common.js index ea4c91767..fc10fabaa 100644 --- a/tests/unit/dialog/dialog_common.js +++ b/tests/unit/dialog/dialog_common.js @@ -4,7 +4,7 @@ TestHelpers.commonWidgetTests( "dialog", { autoOpen: true, buttons: [], closeOnEscape: true, - closeText: "close", + closeText: "Close", disabled: false, dialogClass: "", draggable: true, diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 07c2d6860..66aeebde0 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -209,7 +209,7 @@ test("closeText", function() { expect(3); var element = $("
").dialog(); - equal(element.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "close", + equal(element.dialog("widget").find(".ui-dialog-titlebar-close span").text(), "Close", "default close text"); element.remove(); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 4279d357c..0170a42d2 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -42,7 +42,7 @@ $.widget( "ui.dialog", { autoOpen: true, buttons: [], closeOnEscape: true, - closeText: "close", + closeText: "Close", dialogClass: "", draggable: true, hide: null, -- cgit v1.2.3 From eae2c4b358af3ebfae258abfe77eeace48fcefcb Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Wed, 28 Aug 2013 09:17:01 -0400 Subject: Draggable: Safe activeElement access from iFrames for IE9, prevent window focus changes in IE9+. Fixed #9520 - Draggable: Browser window drops behind other windows in IE9/10 --- ui/jquery.ui.draggable.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 2bdc20255..3b18f28f0 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -76,9 +76,19 @@ $.widget("ui.draggable", $.ui.mouse, { _mouseCapture: function(event) { - var o = this.options; - - $( document.activeElement ).blur(); + var document = this.document[ 0 ], + o = this.options; + + // support: IE9 + // IE9 throws an "Unspecified error" accessing document.activeElement from an