aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-08-31 03:12:22 +0200
committerFelix Nagel <info@felixnagel.com>2013-08-31 03:12:22 +0200
commitcf6dbd8b6bd37362fed0dc4ba72d0d0379bffb1b (patch)
treee4710ae5c790d35f4f18b7e1e7c9603d88bb5a90 /ui
parentd668c94e3e62750e6277fe1dfb9b5faaabd84d2a (diff)
parenteae2c4b358af3ebfae258abfe77eeace48fcefcb (diff)
downloadjquery-ui-cf6dbd8b6bd37362fed0dc4ba72d0d0379bffb1b.tar.gz
jquery-ui-cf6dbd8b6bd37362fed0dc4ba72d0d0379bffb1b.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.dialog.js2
-rw-r--r--ui/jquery.ui.draggable.js38
2 files changed, 30 insertions, 10 deletions
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,
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index ab1e800cd..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 <iframe>
+ try {
+ // Support: IE9+
+ // If the <body> is blurred, IE will switch windows, see #9520
+ if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
+ // Blur any element that currently has focus, see #4261
+ $( document.activeElement ).blur();
+ }
+ } catch ( error ) {}
// among others, prevent a drag on a resizable-handle
if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
@@ -452,7 +462,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 +479,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 +496,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 +562,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 ) )
)
};