jquery-source 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Jquery
2
2
  module Source
3
- VERSION = "1.5.1"
3
+ VERSION = "1.5.2"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v1.5.1
2
+ * jQuery JavaScript Library v1.5.2
3
3
  * http://jquery.com/
4
4
  *
5
5
  * Copyright 2011, John Resig
@@ -11,7 +11,7 @@
11
11
  * Copyright 2011, The Dojo Foundation
12
12
  * Released under the MIT, BSD, and GPL Licenses.
13
13
  *
14
- * Date: Wed Feb 23 13:55:29 2011 -0500
14
+ * Date: Thu Mar 31 15:28:23 2011 -0400
15
15
  */
16
16
  (function( window, undefined ) {
17
17
 
@@ -69,15 +69,9 @@ var jQuery = function( selector, context ) {
69
69
  // For matching the engine and version of the browser
70
70
  browserMatch,
71
71
 
72
- // Has the ready events already been bound?
73
- readyBound = false,
74
-
75
72
  // The deferred used on DOM ready
76
73
  readyList,
77
74
 
78
- // Promise methods
79
- promiseMethods = "then done fail isResolved isRejected promise".split( " " ),
80
-
81
75
  // The ready event handler
82
76
  DOMContentLoaded,
83
77
 
@@ -202,7 +196,7 @@ jQuery.fn = jQuery.prototype = {
202
196
  selector: "",
203
197
 
204
198
  // The current version of jQuery being used
205
- jquery: "1.5.1",
199
+ jquery: "1.5.2",
206
200
 
207
201
  // The default length of a jQuery object is 0
208
202
  length: 0,
@@ -427,11 +421,11 @@ jQuery.extend({
427
421
  },
428
422
 
429
423
  bindReady: function() {
430
- if ( readyBound ) {
424
+ if ( readyList ) {
431
425
  return;
432
426
  }
433
427
 
434
- readyBound = true;
428
+ readyList = jQuery._Deferred();
435
429
 
436
430
  // Catch cases where $(document).ready() is called after the
437
431
  // browser event has already occurred.
@@ -811,6 +805,123 @@ jQuery.extend({
811
805
  return (new Date()).getTime();
812
806
  },
813
807
 
808
+ // Use of jQuery.browser is frowned upon.
809
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
810
+ uaMatch: function( ua ) {
811
+ ua = ua.toLowerCase();
812
+
813
+ var match = rwebkit.exec( ua ) ||
814
+ ropera.exec( ua ) ||
815
+ rmsie.exec( ua ) ||
816
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
817
+ [];
818
+
819
+ return { browser: match[1] || "", version: match[2] || "0" };
820
+ },
821
+
822
+ sub: function() {
823
+ function jQuerySubclass( selector, context ) {
824
+ return new jQuerySubclass.fn.init( selector, context );
825
+ }
826
+ jQuery.extend( true, jQuerySubclass, this );
827
+ jQuerySubclass.superclass = this;
828
+ jQuerySubclass.fn = jQuerySubclass.prototype = this();
829
+ jQuerySubclass.fn.constructor = jQuerySubclass;
830
+ jQuerySubclass.subclass = this.subclass;
831
+ jQuerySubclass.fn.init = function init( selector, context ) {
832
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
833
+ context = jQuerySubclass(context);
834
+ }
835
+
836
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
837
+ };
838
+ jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
839
+ var rootjQuerySubclass = jQuerySubclass(document);
840
+ return jQuerySubclass;
841
+ },
842
+
843
+ browser: {}
844
+ });
845
+
846
+ // Populate the class2type map
847
+ jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
848
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
849
+ });
850
+
851
+ browserMatch = jQuery.uaMatch( userAgent );
852
+ if ( browserMatch.browser ) {
853
+ jQuery.browser[ browserMatch.browser ] = true;
854
+ jQuery.browser.version = browserMatch.version;
855
+ }
856
+
857
+ // Deprecated, use jQuery.browser.webkit instead
858
+ if ( jQuery.browser.webkit ) {
859
+ jQuery.browser.safari = true;
860
+ }
861
+
862
+ if ( indexOf ) {
863
+ jQuery.inArray = function( elem, array ) {
864
+ return indexOf.call( array, elem );
865
+ };
866
+ }
867
+
868
+ // IE doesn't match non-breaking spaces with \s
869
+ if ( rnotwhite.test( "\xA0" ) ) {
870
+ trimLeft = /^[\s\xA0]+/;
871
+ trimRight = /[\s\xA0]+$/;
872
+ }
873
+
874
+ // All jQuery objects should point back to these
875
+ rootjQuery = jQuery(document);
876
+
877
+ // Cleanup functions for the document ready method
878
+ if ( document.addEventListener ) {
879
+ DOMContentLoaded = function() {
880
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
881
+ jQuery.ready();
882
+ };
883
+
884
+ } else if ( document.attachEvent ) {
885
+ DOMContentLoaded = function() {
886
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
887
+ if ( document.readyState === "complete" ) {
888
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
889
+ jQuery.ready();
890
+ }
891
+ };
892
+ }
893
+
894
+ // The DOM ready check for Internet Explorer
895
+ function doScrollCheck() {
896
+ if ( jQuery.isReady ) {
897
+ return;
898
+ }
899
+
900
+ try {
901
+ // If IE is used, use the trick by Diego Perini
902
+ // http://javascript.nwbox.com/IEContentLoaded/
903
+ document.documentElement.doScroll("left");
904
+ } catch(e) {
905
+ setTimeout( doScrollCheck, 1 );
906
+ return;
907
+ }
908
+
909
+ // and execute any waiting functions
910
+ jQuery.ready();
911
+ }
912
+
913
+ // Expose jQuery to the global object
914
+ return jQuery;
915
+
916
+ })();
917
+
918
+
919
+ var // Promise methods
920
+ promiseMethods = "then done fail isResolved isRejected promise".split( " " ),
921
+ // Static reference to slice
922
+ sliceDeferred = [].slice;
923
+
924
+ jQuery.extend({
814
925
  // Create a simple deferred (one callbacks list)
815
926
  _Deferred: function() {
816
927
  var // callbacks list
@@ -856,18 +967,14 @@ jQuery.extend({
856
967
  // resolve with given context and args
857
968
  resolveWith: function( context, args ) {
858
969
  if ( !cancelled && !fired && !firing ) {
970
+ // make sure args are available (#8421)
971
+ args = args || [];
859
972
  firing = 1;
860
973
  try {
861
974
  while( callbacks[ 0 ] ) {
862
975
  callbacks.shift().apply( context, args );
863
976
  }
864
977
  }
865
- // We have to add a catch block for
866
- // IE prior to 8 or else the finally
867
- // block will never get executed
868
- catch (e) {
869
- throw e;
870
- }
871
978
  finally {
872
979
  fired = [ context, args ];
873
980
  firing = 0;
@@ -878,7 +985,7 @@ jQuery.extend({
878
985
 
879
986
  // resolve with this as context and given arguments
880
987
  resolve: function() {
881
- deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments );
988
+ deferred.resolveWith( this, arguments );
882
989
  return this;
883
990
  },
884
991
 
@@ -941,153 +1048,44 @@ jQuery.extend({
941
1048
  },
942
1049
 
943
1050
  // Deferred helper
944
- when: function( object ) {
945
- var lastIndex = arguments.length,
946
- deferred = lastIndex <= 1 && object && jQuery.isFunction( object.promise ) ?
947
- object :
948
- jQuery.Deferred(),
949
- promise = deferred.promise();
950
-
951
- if ( lastIndex > 1 ) {
952
- var array = slice.call( arguments, 0 ),
953
- count = lastIndex,
954
- iCallback = function( index ) {
955
- return function( value ) {
956
- array[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;
957
- if ( !( --count ) ) {
958
- deferred.resolveWith( promise, array );
959
- }
960
- };
961
- };
962
- while( ( lastIndex-- ) ) {
963
- object = array[ lastIndex ];
964
- if ( object && jQuery.isFunction( object.promise ) ) {
965
- object.promise().then( iCallback(lastIndex), deferred.reject );
1051
+ when: function( firstParam ) {
1052
+ var args = arguments,
1053
+ i = 0,
1054
+ length = args.length,
1055
+ count = length,
1056
+ deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
1057
+ firstParam :
1058
+ jQuery.Deferred();
1059
+ function resolveFunc( i ) {
1060
+ return function( value ) {
1061
+ args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
1062
+ if ( !( --count ) ) {
1063
+ // Strange bug in FF4:
1064
+ // Values changed onto the arguments object sometimes end up as undefined values
1065
+ // outside the $.when method. Cloning the object into a fresh array solves the issue
1066
+ deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
1067
+ }
1068
+ };
1069
+ }
1070
+ if ( length > 1 ) {
1071
+ for( ; i < length; i++ ) {
1072
+ if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
1073
+ args[ i ].promise().then( resolveFunc(i), deferred.reject );
966
1074
  } else {
967
1075
  --count;
968
1076
  }
969
1077
  }
970
1078
  if ( !count ) {
971
- deferred.resolveWith( promise, array );
972
- }
973
- } else if ( deferred !== object ) {
974
- deferred.resolve( object );
975
- }
976
- return promise;
977
- },
978
-
979
- // Use of jQuery.browser is frowned upon.
980
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
981
- uaMatch: function( ua ) {
982
- ua = ua.toLowerCase();
983
-
984
- var match = rwebkit.exec( ua ) ||
985
- ropera.exec( ua ) ||
986
- rmsie.exec( ua ) ||
987
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
988
- [];
989
-
990
- return { browser: match[1] || "", version: match[2] || "0" };
991
- },
992
-
993
- sub: function() {
994
- function jQuerySubclass( selector, context ) {
995
- return new jQuerySubclass.fn.init( selector, context );
996
- }
997
- jQuery.extend( true, jQuerySubclass, this );
998
- jQuerySubclass.superclass = this;
999
- jQuerySubclass.fn = jQuerySubclass.prototype = this();
1000
- jQuerySubclass.fn.constructor = jQuerySubclass;
1001
- jQuerySubclass.subclass = this.subclass;
1002
- jQuerySubclass.fn.init = function init( selector, context ) {
1003
- if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
1004
- context = jQuerySubclass(context);
1079
+ deferred.resolveWith( deferred, args );
1005
1080
  }
1006
-
1007
- return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
1008
- };
1009
- jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
1010
- var rootjQuerySubclass = jQuerySubclass(document);
1011
- return jQuerySubclass;
1012
- },
1013
-
1014
- browser: {}
1015
- });
1016
-
1017
- // Create readyList deferred
1018
- readyList = jQuery._Deferred();
1019
-
1020
- // Populate the class2type map
1021
- jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
1022
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
1023
- });
1024
-
1025
- browserMatch = jQuery.uaMatch( userAgent );
1026
- if ( browserMatch.browser ) {
1027
- jQuery.browser[ browserMatch.browser ] = true;
1028
- jQuery.browser.version = browserMatch.version;
1029
- }
1030
-
1031
- // Deprecated, use jQuery.browser.webkit instead
1032
- if ( jQuery.browser.webkit ) {
1033
- jQuery.browser.safari = true;
1034
- }
1035
-
1036
- if ( indexOf ) {
1037
- jQuery.inArray = function( elem, array ) {
1038
- return indexOf.call( array, elem );
1039
- };
1040
- }
1041
-
1042
- // IE doesn't match non-breaking spaces with \s
1043
- if ( rnotwhite.test( "\xA0" ) ) {
1044
- trimLeft = /^[\s\xA0]+/;
1045
- trimRight = /[\s\xA0]+$/;
1046
- }
1047
-
1048
- // All jQuery objects should point back to these
1049
- rootjQuery = jQuery(document);
1050
-
1051
- // Cleanup functions for the document ready method
1052
- if ( document.addEventListener ) {
1053
- DOMContentLoaded = function() {
1054
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
1055
- jQuery.ready();
1056
- };
1057
-
1058
- } else if ( document.attachEvent ) {
1059
- DOMContentLoaded = function() {
1060
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
1061
- if ( document.readyState === "complete" ) {
1062
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
1063
- jQuery.ready();
1081
+ } else if ( deferred !== firstParam ) {
1082
+ deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
1064
1083
  }
1065
- };
1066
- }
1067
-
1068
- // The DOM ready check for Internet Explorer
1069
- function doScrollCheck() {
1070
- if ( jQuery.isReady ) {
1071
- return;
1084
+ return deferred.promise();
1072
1085
  }
1086
+ });
1073
1087
 
1074
- try {
1075
- // If IE is used, use the trick by Diego Perini
1076
- // http://javascript.nwbox.com/IEContentLoaded/
1077
- document.documentElement.doScroll("left");
1078
- } catch(e) {
1079
- setTimeout( doScrollCheck, 1 );
1080
- return;
1081
- }
1082
-
1083
- // and execute any waiting functions
1084
- jQuery.ready();
1085
- }
1086
-
1087
- // Expose jQuery to the global object
1088
- return jQuery;
1089
1088
 
1090
- })();
1091
1089
 
1092
1090
 
1093
1091
  (function() {
@@ -1157,7 +1155,8 @@ return jQuery;
1157
1155
  boxModel: null,
1158
1156
  inlineBlockNeedsLayout: false,
1159
1157
  shrinkWrapBlocks: false,
1160
- reliableHiddenOffsets: true
1158
+ reliableHiddenOffsets: true,
1159
+ reliableMarginRight: true
1161
1160
  };
1162
1161
 
1163
1162
  input.checked = true;
@@ -1175,15 +1174,15 @@ return jQuery;
1175
1174
  script = document.createElement("script"),
1176
1175
  id = "script" + jQuery.now();
1177
1176
 
1177
+ // Make sure that the execution of code works by injecting a script
1178
+ // tag with appendChild/createTextNode
1179
+ // (IE doesn't support this, fails, and uses .text instead)
1178
1180
  try {
1179
1181
  script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
1180
1182
  } catch(e) {}
1181
1183
 
1182
1184
  root.insertBefore( script, root.firstChild );
1183
1185
 
1184
- // Make sure that the execution of code works by injecting a script
1185
- // tag with appendChild/createTextNode
1186
- // (IE doesn't support this, fails, and uses .text instead)
1187
1186
  if ( window[ id ] ) {
1188
1187
  _scriptEval = true;
1189
1188
  delete window[ id ];
@@ -1192,8 +1191,6 @@ return jQuery;
1192
1191
  }
1193
1192
 
1194
1193
  root.removeChild( script );
1195
- // release memory in IE
1196
- root = script = id = null;
1197
1194
  }
1198
1195
 
1199
1196
  return _scriptEval;
@@ -1278,6 +1275,17 @@ return jQuery;
1278
1275
  jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
1279
1276
  div.innerHTML = "";
1280
1277
 
1278
+ // Check if div with explicit width and no margin-right incorrectly
1279
+ // gets computed margin-right based on width of container. For more
1280
+ // info see bug #3333
1281
+ // Fails in WebKit before Feb 2011 nightlies
1282
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1283
+ if ( document.defaultView && document.defaultView.getComputedStyle ) {
1284
+ div.style.width = "1px";
1285
+ div.style.marginRight = "0";
1286
+ jQuery.support.reliableMarginRight = ( parseInt(document.defaultView.getComputedStyle(div, null).marginRight, 10) || 0 ) === 0;
1287
+ }
1288
+
1281
1289
  body.removeChild( div ).style.display = "none";
1282
1290
  div = tds = null;
1283
1291
  });
@@ -1301,8 +1309,6 @@ return jQuery;
1301
1309
  el.setAttribute(eventName, "return;");
1302
1310
  isSupported = typeof el[eventName] === "function";
1303
1311
  }
1304
- el = null;
1305
-
1306
1312
  return isSupported;
1307
1313
  };
1308
1314
 
@@ -2194,10 +2200,10 @@ jQuery.event = {
2194
2200
  }
2195
2201
 
2196
2202
  if ( !eventHandle ) {
2197
- elemData.handle = eventHandle = function() {
2203
+ elemData.handle = eventHandle = function( e ) {
2198
2204
  // Handle the second event of a trigger and when
2199
2205
  // an event is called after a page has unloaded
2200
- return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
2206
+ return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
2201
2207
  jQuery.event.handle.apply( eventHandle.elem, arguments ) :
2202
2208
  undefined;
2203
2209
  };
@@ -2504,7 +2510,7 @@ jQuery.event = {
2504
2510
  target[ "on" + targetType ] = null;
2505
2511
  }
2506
2512
 
2507
- jQuery.event.triggered = true;
2513
+ jQuery.event.triggered = event.type;
2508
2514
  target[ targetType ]();
2509
2515
  }
2510
2516
 
@@ -2515,7 +2521,7 @@ jQuery.event = {
2515
2521
  target[ "on" + targetType ] = old;
2516
2522
  }
2517
2523
 
2518
- jQuery.event.triggered = false;
2524
+ jQuery.event.triggered = undefined;
2519
2525
  }
2520
2526
  }
2521
2527
  },
@@ -2785,7 +2791,7 @@ var withinElement = function( event ) {
2785
2791
 
2786
2792
  // Chrome does something similar, the parentNode property
2787
2793
  // can be accessed but is null.
2788
- if ( parent !== document && !parent.parentNode ) {
2794
+ if ( parent && parent !== document && !parent.parentNode ) {
2789
2795
  return;
2790
2796
  }
2791
2797
  // Traverse up the tree
@@ -2992,19 +2998,33 @@ function trigger( type, elem, args ) {
2992
2998
  // Create "bubbling" focus and blur events
2993
2999
  if ( document.addEventListener ) {
2994
3000
  jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
3001
+
3002
+ // Attach a single capturing handler while someone wants focusin/focusout
3003
+ var attaches = 0;
3004
+
2995
3005
  jQuery.event.special[ fix ] = {
2996
3006
  setup: function() {
2997
- this.addEventListener( orig, handler, true );
3007
+ if ( attaches++ === 0 ) {
3008
+ document.addEventListener( orig, handler, true );
3009
+ }
2998
3010
  },
2999
3011
  teardown: function() {
3000
- this.removeEventListener( orig, handler, true );
3012
+ if ( --attaches === 0 ) {
3013
+ document.removeEventListener( orig, handler, true );
3014
+ }
3001
3015
  }
3002
3016
  };
3003
3017
 
3004
- function handler( e ) {
3005
- e = jQuery.event.fix( e );
3018
+ function handler( donor ) {
3019
+ // Donor event is always a native one; fix it and switch its type.
3020
+ // Let focusin/out handler cancel the donor focus/blur event.
3021
+ var e = jQuery.event.fix( donor );
3006
3022
  e.type = fix;
3007
- return jQuery.event.handle.call( this, e );
3023
+ e.originalEvent = {};
3024
+ jQuery.event.trigger( e, null, e.target );
3025
+ if ( e.isDefaultPrevented() ) {
3026
+ donor.preventDefault();
3027
+ }
3008
3028
  }
3009
3029
  });
3010
3030
  }
@@ -3918,10 +3938,12 @@ var Expr = Sizzle.selectors = {
3918
3938
  },
3919
3939
 
3920
3940
  text: function( elem ) {
3941
+ var attr = elem.getAttribute( "type" ), type = elem.type;
3921
3942
  // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
3922
3943
  // use getAttribute instead to test this case
3923
- return "text" === elem.getAttribute( 'type' );
3944
+ return "text" === type && ( attr === type || attr === null );
3924
3945
  },
3946
+
3925
3947
  radio: function( elem ) {
3926
3948
  return "radio" === elem.type;
3927
3949
  },
@@ -4496,19 +4518,23 @@ if ( document.querySelectorAll ) {
4496
4518
 
4497
4519
  (function(){
4498
4520
  var html = document.documentElement,
4499
- matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
4500
- pseudoWorks = false;
4521
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
4501
4522
 
4502
- try {
4503
- // This should fail with an exception
4504
- // Gecko does not error, returns false instead
4505
- matches.call( document.documentElement, "[test!='']:sizzle" );
4523
+ if ( matches ) {
4524
+ // Check to see if it's possible to do matchesSelector
4525
+ // on a disconnected node (IE 9 fails this)
4526
+ var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
4527
+ pseudoWorks = false;
4528
+
4529
+ try {
4530
+ // This should fail with an exception
4531
+ // Gecko does not error, returns false instead
4532
+ matches.call( document.documentElement, "[test!='']:sizzle" );
4506
4533
 
4507
- } catch( pseudoError ) {
4508
- pseudoWorks = true;
4509
- }
4534
+ } catch( pseudoError ) {
4535
+ pseudoWorks = true;
4536
+ }
4510
4537
 
4511
- if ( matches ) {
4512
4538
  Sizzle.matchesSelector = function( node, expr ) {
4513
4539
  // Make sure that attribute selectors are quoted
4514
4540
  expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
@@ -4516,7 +4542,15 @@ if ( document.querySelectorAll ) {
4516
4542
  if ( !Sizzle.isXML( node ) ) {
4517
4543
  try {
4518
4544
  if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
4519
- return matches.call( node, expr );
4545
+ var ret = matches.call( node, expr );
4546
+
4547
+ // IE 9's matchesSelector returns false on disconnected nodes
4548
+ if ( ret || !disconnectedMatch ||
4549
+ // As well, disconnected nodes are said to be in a document
4550
+ // fragment in IE 9, so check for that
4551
+ node.document && node.document.nodeType !== 11 ) {
4552
+ return ret;
4553
+ }
4520
4554
  }
4521
4555
  } catch(e) {}
4522
4556
  }
@@ -5260,7 +5294,9 @@ jQuery.fn.extend({
5260
5294
  }
5261
5295
  });
5262
5296
  } else {
5263
- return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
5297
+ return this.length ?
5298
+ this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
5299
+ this;
5264
5300
  }
5265
5301
  },
5266
5302
 
@@ -5707,7 +5743,8 @@ function evalScript( i, elem ) {
5707
5743
  var ralpha = /alpha\([^)]*\)/i,
5708
5744
  ropacity = /opacity=([^)]*)/,
5709
5745
  rdashAlpha = /-([a-z])/ig,
5710
- rupper = /([A-Z])/g,
5746
+ // fixed for IE9, see #8346
5747
+ rupper = /([A-Z]|^ms)/g,
5711
5748
  rnumpx = /^-?\d+(?:px)?$/i,
5712
5749
  rnum = /^-?\d/,
5713
5750
 
@@ -5944,6 +5981,28 @@ if ( !jQuery.support.opacity ) {
5944
5981
  };
5945
5982
  }
5946
5983
 
5984
+ jQuery(function() {
5985
+ // This hook cannot be added until DOM ready because the support test
5986
+ // for it is not run until after DOM ready
5987
+ if ( !jQuery.support.reliableMarginRight ) {
5988
+ jQuery.cssHooks.marginRight = {
5989
+ get: function( elem, computed ) {
5990
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
5991
+ // Work around by temporarily setting element display to inline-block
5992
+ var ret;
5993
+ jQuery.swap( elem, { "display": "inline-block" }, function() {
5994
+ if ( computed ) {
5995
+ ret = curCSS( elem, "margin-right", "marginRight" );
5996
+ } else {
5997
+ ret = elem.style.marginRight;
5998
+ }
5999
+ });
6000
+ return ret;
6001
+ }
6002
+ };
6003
+ }
6004
+ });
6005
+
5947
6006
  if ( document.defaultView && document.defaultView.getComputedStyle ) {
5948
6007
  getComputedStyle = function( elem, newName, name ) {
5949
6008
  var ret, defaultView, computedStyle;
@@ -6048,7 +6107,7 @@ var r20 = /%20/g,
6048
6107
  rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
6049
6108
  rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
6050
6109
  // #7653, #8125, #8152: local protocol detection
6051
- rlocalProtocol = /(?:^file|^widget|\-extension):$/,
6110
+ rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
6052
6111
  rnoContent = /^(?:GET|HEAD)$/,
6053
6112
  rprotocol = /^\/\//,
6054
6113
  rquery = /\?/,
@@ -6060,7 +6119,7 @@ var r20 = /%20/g,
6060
6119
  rucHeadersFunc = function( _, $1, $2 ) {
6061
6120
  return $1 + $2.toUpperCase();
6062
6121
  },
6063
- rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,
6122
+ rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
6064
6123
 
6065
6124
  // Keep a copy of the old load method
6066
6125
  _load = jQuery.fn.load,
@@ -6102,7 +6161,7 @@ try {
6102
6161
  }
6103
6162
 
6104
6163
  // Segment location into parts
6105
- ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() );
6164
+ ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
6106
6165
 
6107
6166
  // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
6108
6167
  function addToPrefiltersOrTransports( structure ) {
@@ -6360,7 +6419,6 @@ jQuery.extend({
6360
6419
  cache: null,
6361
6420
  traditional: false,
6362
6421
  headers: {},
6363
- crossDomain: null,
6364
6422
  */
6365
6423
 
6366
6424
  accepts: {
@@ -6645,7 +6703,7 @@ jQuery.extend({
6645
6703
  s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
6646
6704
 
6647
6705
  // Determine if a cross-domain request is in order
6648
- if ( !s.crossDomain ) {
6706
+ if ( s.crossDomain == null ) {
6649
6707
  parts = rurl.exec( s.url.toLowerCase() );
6650
6708
  s.crossDomain = !!( parts &&
6651
6709
  ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
@@ -7024,7 +7082,7 @@ function ajaxConvert( s, response ) {
7024
7082
 
7025
7083
 
7026
7084
  var jsc = jQuery.now(),
7027
- jsre = /(\=)\?(&|$)|()\?\?()/i;
7085
+ jsre = /(\=)\?(&|$)|\?\?/i;
7028
7086
 
7029
7087
  // Default jsonp settings
7030
7088
  jQuery.ajaxSetup({
@@ -7285,11 +7343,12 @@ if ( jQuery.support.ajax ) {
7285
7343
  xhr.overrideMimeType( s.mimeType );
7286
7344
  }
7287
7345
 
7288
- // Requested-With header
7289
- // Not set for crossDomain requests with no content
7290
- // (see why at http://trac.dojotoolkit.org/ticket/9486)
7291
- // Won't change header if already provided
7292
- if ( !( s.crossDomain && !s.hasContent ) && !headers["X-Requested-With"] ) {
7346
+ // X-Requested-With header
7347
+ // For cross-domain requests, seeing as conditions for a preflight are
7348
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
7349
+ // (it can always be set on a per-request basis or even using ajaxSetup)
7350
+ // For same-domain requests, won't change header if already provided.
7351
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
7293
7352
  headers[ "X-Requested-With" ] = "XMLHttpRequest";
7294
7353
  }
7295
7354
 
@@ -7979,8 +8038,8 @@ if ( "getBoundingClientRect" in document.documentElement ) {
7979
8038
  win = getWindow(doc),
7980
8039
  clientTop = docElem.clientTop || body.clientTop || 0,
7981
8040
  clientLeft = docElem.clientLeft || body.clientLeft || 0,
7982
- scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
7983
- scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
8041
+ scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
8042
+ scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
7984
8043
  top = box.top + scrollTop - clientTop,
7985
8044
  left = box.left + scrollLeft - clientLeft;
7986
8045
 
@@ -8093,7 +8152,6 @@ jQuery.offset = {
8093
8152
  this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
8094
8153
 
8095
8154
  body.removeChild( container );
8096
- body = container = innerDiv = checkDiv = table = td = null;
8097
8155
  jQuery.offset.initialize = jQuery.noop;
8098
8156
  },
8099
8157
 
@@ -8123,10 +8181,10 @@ jQuery.offset = {
8123
8181
  curOffset = curElem.offset(),
8124
8182
  curCSSTop = jQuery.css( elem, "top" ),
8125
8183
  curCSSLeft = jQuery.css( elem, "left" ),
8126
- calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
8184
+ calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1,
8127
8185
  props = {}, curPosition = {}, curTop, curLeft;
8128
8186
 
8129
- // need to be able to calculate position if either top or left is auto and position is absolute
8187
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
8130
8188
  if ( calculatePosition ) {
8131
8189
  curPosition = curElem.position();
8132
8190
  }
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jquery-source
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.5.1
5
+ version: 1.5.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel X. Moore