Merge branch 'master' of git://github.com/jquery/jquery into 2773_find_closest
This commit is contained in:
commit
6da3885cc3
12 changed files with 188 additions and 35 deletions
25
src/css.js
25
src/css.js
|
@ -3,7 +3,8 @@
|
|||
var ralpha = /alpha\([^)]*\)/i,
|
||||
ropacity = /opacity=([^)]*)/,
|
||||
rdashAlpha = /-([a-z])/ig,
|
||||
rupper = /([A-Z])/g,
|
||||
// fixed for IE9, see #8346
|
||||
rupper = /([A-Z]|^ms)/g,
|
||||
rnumpx = /^-?\d+(?:px)?$/i,
|
||||
rnum = /^-?\d/,
|
||||
|
||||
|
@ -240,6 +241,28 @@ if ( !jQuery.support.opacity ) {
|
|||
};
|
||||
}
|
||||
|
||||
jQuery(function() {
|
||||
// This hook cannot be added until DOM ready because the support test
|
||||
// for it is not run until after DOM ready
|
||||
if ( !jQuery.support.reliableMarginRight ) {
|
||||
jQuery.cssHooks.marginRight = {
|
||||
get: function( elem, computed ) {
|
||||
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
||||
// Work around by temporarily setting element display to inline-block
|
||||
var ret;
|
||||
jQuery.swap( elem, { "display": "inline-block" }, function() {
|
||||
if ( computed ) {
|
||||
ret = curCSS( elem, "margin-right", "marginRight" );
|
||||
} else {
|
||||
ret = elem.style.marginRight;
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
if ( document.defaultView && document.defaultView.getComputedStyle ) {
|
||||
getComputedStyle = function( elem, newName, name ) {
|
||||
var ret, defaultView, computedStyle;
|
||||
|
|
|
@ -144,7 +144,10 @@ jQuery.extend({
|
|||
return function( value ) {
|
||||
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
|
||||
if ( !( --count ) ) {
|
||||
deferred.resolveWith( deferred, args );
|
||||
// Strange bug in FF4:
|
||||
// Values changed onto the arguments object sometimes end up as undefined values
|
||||
// outside the $.when method. Cloning the object into a fresh array solves the issue
|
||||
deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
34
src/event.js
34
src/event.js
|
@ -70,10 +70,10 @@ jQuery.event = {
|
|||
}
|
||||
|
||||
if ( !eventHandle ) {
|
||||
elemData.handle = eventHandle = function() {
|
||||
elemData.handle = eventHandle = function( e ) {
|
||||
// Handle the second event of a trigger and when
|
||||
// an event is called after a page has unloaded
|
||||
return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
|
||||
return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
|
||||
jQuery.event.handle.apply( eventHandle.elem, arguments ) :
|
||||
undefined;
|
||||
};
|
||||
|
@ -380,7 +380,7 @@ jQuery.event = {
|
|||
target[ "on" + targetType ] = null;
|
||||
}
|
||||
|
||||
jQuery.event.triggered = true;
|
||||
jQuery.event.triggered = event.type;
|
||||
target[ targetType ]();
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,7 @@ jQuery.event = {
|
|||
target[ "on" + targetType ] = old;
|
||||
}
|
||||
|
||||
jQuery.event.triggered = false;
|
||||
jQuery.event.triggered = undefined;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -661,7 +661,7 @@ var withinElement = function( event ) {
|
|||
|
||||
// Chrome does something similar, the parentNode property
|
||||
// can be accessed but is null.
|
||||
if ( parent !== document && !parent.parentNode ) {
|
||||
if ( parent && parent !== document && !parent.parentNode ) {
|
||||
return;
|
||||
}
|
||||
// Traverse up the tree
|
||||
|
@ -868,19 +868,33 @@ function trigger( type, elem, args ) {
|
|||
// Create "bubbling" focus and blur events
|
||||
if ( document.addEventListener ) {
|
||||
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
||||
|
||||
// Attach a single capturing handler while someone wants focusin/focusout
|
||||
var attaches = 0;
|
||||
|
||||
jQuery.event.special[ fix ] = {
|
||||
setup: function() {
|
||||
this.addEventListener( orig, handler, true );
|
||||
if ( attaches++ === 0 ) {
|
||||
document.addEventListener( orig, handler, true );
|
||||
}
|
||||
},
|
||||
teardown: function() {
|
||||
this.removeEventListener( orig, handler, true );
|
||||
if ( --attaches === 0 ) {
|
||||
document.removeEventListener( orig, handler, true );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handler( e ) {
|
||||
e = jQuery.event.fix( e );
|
||||
function handler( donor ) {
|
||||
// Donor event is always a native one; fix it and switch its type.
|
||||
// Let focusin/out handler cancel the donor focus/blur event.
|
||||
var e = jQuery.event.fix( donor );
|
||||
e.type = fix;
|
||||
return jQuery.event.handle.call( this, e );
|
||||
e.originalEvent = {};
|
||||
jQuery.event.trigger( e, null, e.target );
|
||||
if ( e.isDefaultPrevented() ) {
|
||||
donor.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -151,7 +151,6 @@ jQuery.offset = {
|
|||
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
|
||||
|
||||
body.removeChild( container );
|
||||
body = container = innerDiv = checkDiv = table = td = null;
|
||||
jQuery.offset.initialize = jQuery.noop;
|
||||
},
|
||||
|
||||
|
@ -181,10 +180,10 @@ jQuery.offset = {
|
|||
curOffset = curElem.offset(),
|
||||
curCSSTop = jQuery.css( elem, "top" ),
|
||||
curCSSLeft = jQuery.css( elem, "left" ),
|
||||
calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
|
||||
calculatePosition = ((position === "absolute" || position === "fixed") && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
|
||||
props = {}, curPosition = {}, curTop, curLeft;
|
||||
|
||||
// need to be able to calculate position if either top or left is auto and position is absolute
|
||||
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
|
||||
if ( calculatePosition ) {
|
||||
curPosition = curElem.position();
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ef19279f54ba49242c6461d47577c703f4f4e80e
|
||||
Subproject commit f12b9309269ba7e705a99efe099f86ed1fe98d58
|
|
@ -67,7 +67,8 @@
|
|||
boxModel: null,
|
||||
inlineBlockNeedsLayout: false,
|
||||
shrinkWrapBlocks: false,
|
||||
reliableHiddenOffsets: true
|
||||
reliableHiddenOffsets: true,
|
||||
reliableMarginRight: true
|
||||
};
|
||||
|
||||
input.checked = true;
|
||||
|
@ -85,15 +86,15 @@
|
|||
script = document.createElement("script"),
|
||||
id = "script" + jQuery.now();
|
||||
|
||||
// Make sure that the execution of code works by injecting a script
|
||||
// tag with appendChild/createTextNode
|
||||
// (IE doesn't support this, fails, and uses .text instead)
|
||||
try {
|
||||
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
|
||||
} catch(e) {}
|
||||
|
||||
root.insertBefore( script, root.firstChild );
|
||||
|
||||
// Make sure that the execution of code works by injecting a script
|
||||
// tag with appendChild/createTextNode
|
||||
// (IE doesn't support this, fails, and uses .text instead)
|
||||
if ( window[ id ] ) {
|
||||
_scriptEval = true;
|
||||
delete window[ id ];
|
||||
|
@ -102,8 +103,6 @@
|
|||
}
|
||||
|
||||
root.removeChild( script );
|
||||
// release memory in IE
|
||||
root = script = id = null;
|
||||
}
|
||||
|
||||
return _scriptEval;
|
||||
|
@ -188,6 +187,17 @@
|
|||
jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
|
||||
div.innerHTML = "";
|
||||
|
||||
// Check if div with explicit width and no margin-right incorrectly
|
||||
// gets computed margin-right based on width of container. For more
|
||||
// info see bug #3333
|
||||
// Fails in WebKit before Feb 2011 nightlies
|
||||
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
||||
if ( document.defaultView && document.defaultView.getComputedStyle ) {
|
||||
div.style.width = "1px";
|
||||
div.style.marginRight = "0";
|
||||
jQuery.support.reliableMarginRight = ( parseInt(document.defaultView.getComputedStyle(div, null).marginRight, 10) || 0 ) === 0;
|
||||
}
|
||||
|
||||
body.removeChild( div ).style.display = "none";
|
||||
div = tds = null;
|
||||
});
|
||||
|
@ -211,8 +221,6 @@
|
|||
el.setAttribute(eventName, "return;");
|
||||
isSupported = typeof el[eventName] === "function";
|
||||
}
|
||||
el = null;
|
||||
|
||||
return isSupported;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue