jquery-source 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  module Jquery
2
2
  module Source
3
- VERSION = "1.4.0"
3
+ VERSION = "1.4.1"
4
4
  end
5
5
  end
@@ -1,17 +1,17 @@
1
1
  /*!
2
- * jQuery JavaScript Library v1.4
2
+ * jQuery JavaScript Library v1.4.1
3
3
  * http://jquery.com/
4
4
  *
5
5
  * Copyright 2010, John Resig
6
6
  * Dual licensed under the MIT or GPL Version 2 licenses.
7
- * http://docs.jquery.com/License
7
+ * http://jquery.org/license
8
8
  *
9
9
  * Includes Sizzle.js
10
10
  * http://sizzlejs.com/
11
11
  * Copyright 2010, The Dojo Foundation
12
12
  * Released under the MIT, BSD, and GPL Licenses.
13
13
  *
14
- * Date: Wed Jan 13 15:23:05 2010 -0500
14
+ * Date: Mon Jan 25 19:43:33 2010 -0500
15
15
  */
16
16
  (function( window, undefined ) {
17
17
 
@@ -174,7 +174,7 @@ jQuery.fn = jQuery.prototype = {
174
174
  selector: "",
175
175
 
176
176
  // The current version of jQuery being used
177
- jquery: "1.4",
177
+ jquery: "1.4.1",
178
178
 
179
179
  // The default length of a jQuery object is 0
180
180
  length: 0,
@@ -483,6 +483,31 @@ jQuery.extend({
483
483
  }
484
484
  return true;
485
485
  },
486
+
487
+ error: function( msg ) {
488
+ throw msg;
489
+ },
490
+
491
+ parseJSON: function( data ) {
492
+ if ( typeof data !== "string" || !data ) {
493
+ return null;
494
+ }
495
+
496
+ // Make sure the incoming data is actual JSON
497
+ // Logic borrowed from http://json.org/json2.js
498
+ if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
499
+ .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
500
+ .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
501
+
502
+ // Try to use the native JSON parser first
503
+ return window.JSON && window.JSON.parse ?
504
+ window.JSON.parse( data ) :
505
+ (new Function("return " + data))();
506
+
507
+ } else {
508
+ jQuery.error( "Invalid JSON: " + data );
509
+ }
510
+ },
486
511
 
487
512
  noop: function() {},
488
513
 
@@ -670,26 +695,15 @@ jQuery.extend({
670
695
  // Use of jQuery.browser is frowned upon.
671
696
  // More details: http://docs.jquery.com/Utilities/jQuery.browser
672
697
  uaMatch: function( ua ) {
673
- var ret = { browser: "" };
674
-
675
698
  ua = ua.toLowerCase();
676
699
 
677
- if ( /webkit/.test( ua ) ) {
678
- ret = { browser: "webkit", version: /webkit[\/ ]([\w.]+)/ };
679
-
680
- } else if ( /opera/.test( ua ) ) {
681
- ret = { browser: "opera", version: /version/.test( ua ) ? /version[\/ ]([\w.]+)/ : /opera[\/ ]([\w.]+)/ };
682
-
683
- } else if ( /msie/.test( ua ) ) {
684
- ret = { browser: "msie", version: /msie ([\w.]+)/ };
685
-
686
- } else if ( /mozilla/.test( ua ) && !/compatible/.test( ua ) ) {
687
- ret = { browser: "mozilla", version: /rv:([\w.]+)/ };
688
- }
689
-
690
- ret.version = (ret.version && ret.version.exec( ua ) || [0, "0"])[1];
700
+ var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
701
+ /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
702
+ /(msie) ([\w.]+)/.exec( ua ) ||
703
+ !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
704
+ [];
691
705
 
692
- return ret;
706
+ return { browser: match[1] || "", version: match[2] || "0" };
693
707
  },
694
708
 
695
709
  browser: {}
@@ -751,12 +765,6 @@ function doScrollCheck() {
751
765
  jQuery.ready();
752
766
  }
753
767
 
754
- if ( indexOf ) {
755
- jQuery.inArray = function( elem, array ) {
756
- return indexOf.call( array, elem );
757
- };
758
- }
759
-
760
768
  function evalScript( i, elem ) {
761
769
  if ( elem.src ) {
762
770
  jQuery.ajax({
@@ -864,6 +872,7 @@ function now() {
864
872
  optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
865
873
 
866
874
  // Will be defined later
875
+ checkClone: false,
867
876
  scriptEval: false,
868
877
  noCloneEvent: true,
869
878
  boxModel: null
@@ -896,9 +905,17 @@ function now() {
896
905
  div.cloneNode(true).fireEvent("onclick");
897
906
  }
898
907
 
908
+ div = document.createElement("div");
909
+ div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
910
+
911
+ var fragment = document.createDocumentFragment();
912
+ fragment.appendChild( div.firstChild );
913
+
914
+ // WebKit doesn't clone checked state correctly in fragments
915
+ jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
916
+
899
917
  // Figure out if the W3C box model works as expected
900
918
  // document.body must exist before we can do this
901
- // TODO: This timeout is temporary until I move ready into core.js.
902
919
  jQuery(function() {
903
920
  var div = document.createElement("div");
904
921
  div.style.width = div.style.paddingLeft = "1px";
@@ -1454,7 +1471,7 @@ jQuery.extend({
1454
1471
  if ( set ) {
1455
1472
  // We can't allow the type property to be changed (since it causes problems in IE)
1456
1473
  if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
1457
- throw "type property can't be changed";
1474
+ jQuery.error( "type property can't be changed" );
1458
1475
  }
1459
1476
 
1460
1477
  elem[ name ] = value;
@@ -1580,19 +1597,28 @@ jQuery.event = {
1580
1597
  // Handle multiple events separated by a space
1581
1598
  // jQuery(...).bind("mouseover mouseout", fn);
1582
1599
  types = types.split( /\s+/ );
1583
- var type, i=0;
1600
+
1601
+ var type, i = 0;
1602
+
1584
1603
  while ( (type = types[ i++ ]) ) {
1585
1604
  // Namespaced event handlers
1586
1605
  var namespaces = type.split(".");
1587
1606
  type = namespaces.shift();
1607
+
1608
+ if ( i > 1 ) {
1609
+ handler = jQuery.proxy( handler );
1610
+
1611
+ if ( data !== undefined ) {
1612
+ handler.data = data;
1613
+ }
1614
+ }
1615
+
1588
1616
  handler.type = namespaces.slice(0).sort().join(".");
1589
1617
 
1590
1618
  // Get the current list of functions bound to this event
1591
1619
  var handlers = events[ type ],
1592
1620
  special = this.special[ type ] || {};
1593
1621
 
1594
-
1595
-
1596
1622
  // Init the event handler queue
1597
1623
  if ( !handlers ) {
1598
1624
  handlers = events[ type ] = {};
@@ -1614,6 +1640,8 @@ jQuery.event = {
1614
1640
  var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers );
1615
1641
  if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) {
1616
1642
  modifiedHandler.guid = modifiedHandler.guid || handler.guid;
1643
+ modifiedHandler.data = modifiedHandler.data || handler.data;
1644
+ modifiedHandler.type = modifiedHandler.type || handler.type;
1617
1645
  handler = modifiedHandler;
1618
1646
  }
1619
1647
  }
@@ -1779,36 +1807,48 @@ jQuery.event = {
1779
1807
  handle.apply( elem, data );
1780
1808
  }
1781
1809
 
1782
- var nativeFn, nativeHandler;
1810
+ var parent = elem.parentNode || elem.ownerDocument;
1811
+
1812
+ // Trigger an inline bound script
1783
1813
  try {
1784
1814
  if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
1785
- nativeFn = elem[ type ];
1786
- nativeHandler = elem[ "on" + type ];
1815
+ if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
1816
+ event.result = false;
1817
+ }
1787
1818
  }
1819
+
1788
1820
  // prevent IE from throwing an error for some elements with some event types, see #3533
1789
1821
  } catch (e) {}
1790
1822
 
1791
- var isClick = jQuery.nodeName(elem, "a") && type === "click";
1823
+ if ( !event.isPropagationStopped() && parent ) {
1824
+ jQuery.event.trigger( event, data, parent, true );
1792
1825
 
1793
- // Trigger the native events (except for clicks on links)
1794
- if ( !bubbling && nativeFn && !event.isDefaultPrevented() && !isClick ) {
1795
- this.triggered = true;
1796
- try {
1797
- elem[ type ]();
1798
- // prevent IE from throwing an error for some hidden elements
1799
- } catch (e) {}
1826
+ } else if ( !event.isDefaultPrevented() ) {
1827
+ var target = event.target, old,
1828
+ isClick = jQuery.nodeName(target, "a") && type === "click";
1800
1829
 
1801
- // Handle triggering native .onfoo handlers
1802
- } else if ( nativeHandler && elem[ "on" + type ].apply( elem, data ) === false ) {
1803
- event.result = false;
1804
- }
1830
+ if ( !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
1831
+ try {
1832
+ if ( target[ type ] ) {
1833
+ // Make sure that we don't accidentally re-trigger the onFOO events
1834
+ old = target[ "on" + type ];
1835
+
1836
+ if ( old ) {
1837
+ target[ "on" + type ] = null;
1838
+ }
1839
+
1840
+ this.triggered = true;
1841
+ target[ type ]();
1842
+ }
1843
+
1844
+ // prevent IE from throwing an error for some elements with some event types, see #3533
1845
+ } catch (e) {}
1805
1846
 
1806
- this.triggered = false;
1847
+ if ( old ) {
1848
+ target[ "on" + type ] = old;
1849
+ }
1807
1850
 
1808
- if ( !event.isPropagationStopped() ) {
1809
- var parent = elem.parentNode || elem.ownerDocument;
1810
- if ( parent ) {
1811
- jQuery.event.trigger( event, data, parent, true );
1851
+ this.triggered = false;
1812
1852
  }
1813
1853
  }
1814
1854
  },
@@ -1937,6 +1977,8 @@ jQuery.event = {
1937
1977
  jQuery.extend( proxy, data || {} );
1938
1978
 
1939
1979
  proxy.guid += data.selector + data.live;
1980
+ data.liveProxy = proxy;
1981
+
1940
1982
  jQuery.event.add( this, data.live, liveHandler, data );
1941
1983
 
1942
1984
  },
@@ -2168,18 +2210,18 @@ function testChange( e ) {
2168
2210
  data = jQuery.data( elem, "_change_data" );
2169
2211
  val = getVal(elem);
2170
2212
 
2171
- if ( val === data ) {
2172
- return;
2173
- }
2174
-
2175
2213
  // the current data will be also retrieved by beforeactivate
2176
2214
  if ( e.type !== "focusout" || elem.type !== "radio" ) {
2177
2215
  jQuery.data( elem, "_change_data", val );
2178
2216
  }
2217
+
2218
+ if ( data === undefined || val === data ) {
2219
+ return;
2220
+ }
2179
2221
 
2180
- if ( elem.type !== "select" && (data != null || val) ) {
2222
+ if ( data != null || val ) {
2181
2223
  e.type = "change";
2182
- return jQuery.event.trigger( e, arguments[1], this );
2224
+ return jQuery.event.trigger( e, arguments[1], elem );
2183
2225
  }
2184
2226
  }
2185
2227
 
@@ -2274,7 +2316,6 @@ jQuery.each(["bind", "one"], function( i, name ) {
2274
2316
  }
2275
2317
 
2276
2318
  if ( jQuery.isFunction( data ) ) {
2277
- thisObject = fn;
2278
2319
  fn = data;
2279
2320
  data = undefined;
2280
2321
  }
@@ -2285,7 +2326,7 @@ jQuery.each(["bind", "one"], function( i, name ) {
2285
2326
  }) : fn;
2286
2327
 
2287
2328
  return type === "unload" && name !== "one" ?
2288
- this.one( type, data, fn, thisObject ) :
2329
+ this.one( type, data, fn ) :
2289
2330
  this.each(function() {
2290
2331
  jQuery.event.add( this, type, handler, data );
2291
2332
  });
@@ -2346,32 +2387,52 @@ jQuery.fn.extend({
2346
2387
 
2347
2388
  hover: function( fnOver, fnOut ) {
2348
2389
  return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
2349
- },
2390
+ }
2391
+ });
2392
+
2393
+ jQuery.each(["live", "die"], function( i, name ) {
2394
+ jQuery.fn[ name ] = function( types, data, fn ) {
2395
+ var type, i = 0;
2350
2396
 
2351
- live: function( type, data, fn ) {
2352
2397
  if ( jQuery.isFunction( data ) ) {
2353
2398
  fn = data;
2354
2399
  data = undefined;
2355
2400
  }
2356
2401
 
2357
- jQuery( this.context ).bind( liveConvert( type, this.selector ), {
2358
- data: data, selector: this.selector, live: type
2359
- }, fn );
2402
+ types = (types || "").split( /\s+/ );
2360
2403
 
2361
- return this;
2362
- },
2404
+ while ( (type = types[ i++ ]) != null ) {
2405
+ type = type === "focus" ? "focusin" : // focus --> focusin
2406
+ type === "blur" ? "focusout" : // blur --> focusout
2407
+ type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support
2408
+ type;
2409
+
2410
+ if ( name === "live" ) {
2411
+ // bind live handler
2412
+ jQuery( this.context ).bind( liveConvert( type, this.selector ), {
2413
+ data: data, selector: this.selector, live: type
2414
+ }, fn );
2363
2415
 
2364
- die: function( type, fn ) {
2365
- jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
2416
+ } else {
2417
+ // unbind live handler
2418
+ jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
2419
+ }
2420
+ }
2421
+
2366
2422
  return this;
2367
2423
  }
2368
2424
  });
2369
2425
 
2370
2426
  function liveHandler( event ) {
2371
- var stop = true, elems = [], selectors = [], args = arguments,
2372
- related, match, fn, elem, j, i, data,
2427
+ var stop, elems = [], selectors = [], args = arguments,
2428
+ related, match, fn, elem, j, i, l, data,
2373
2429
  live = jQuery.extend({}, jQuery.data( this, "events" ).live);
2374
2430
 
2431
+ // Make sure we avoid non-left-click bubbling in Firefox (#3861)
2432
+ if ( event.button && event.type === "click" ) {
2433
+ return;
2434
+ }
2435
+
2375
2436
  for ( j in live ) {
2376
2437
  fn = live[j];
2377
2438
  if ( fn.live === event.type ||
@@ -2422,7 +2483,7 @@ function liveHandler( event ) {
2422
2483
  }
2423
2484
 
2424
2485
  function liveConvert( type, selector ) {
2425
- return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "&")].join(".");
2486
+ return "live." + (type ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
2426
2487
  }
2427
2488
 
2428
2489
  jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
@@ -2569,7 +2630,7 @@ var Sizzle = function(selector, context, results, seed) {
2569
2630
  }
2570
2631
 
2571
2632
  if ( !checkSet ) {
2572
- throw "Syntax error, unrecognized expression: " + (cur || selector);
2633
+ Sizzle.error( cur || selector );
2573
2634
  }
2574
2635
 
2575
2636
  if ( toString.call(checkSet) === "[object Array]" ) {
@@ -2722,7 +2783,7 @@ Sizzle.filter = function(expr, set, inplace, not){
2722
2783
  // Improper expression
2723
2784
  if ( expr === old ) {
2724
2785
  if ( anyFound == null ) {
2725
- throw "Syntax error, unrecognized expression: " + expr;
2786
+ Sizzle.error( expr );
2726
2787
  } else {
2727
2788
  break;
2728
2789
  }
@@ -2734,6 +2795,10 @@ Sizzle.filter = function(expr, set, inplace, not){
2734
2795
  return curLoop;
2735
2796
  };
2736
2797
 
2798
+ Sizzle.error = function( msg ) {
2799
+ throw "Syntax error, unrecognized expression: " + msg;
2800
+ };
2801
+
2737
2802
  var Expr = Sizzle.selectors = {
2738
2803
  order: [ "ID", "NAME", "TAG" ],
2739
2804
  match: {
@@ -3038,7 +3103,7 @@ var Expr = Sizzle.selectors = {
3038
3103
 
3039
3104
  return true;
3040
3105
  } else {
3041
- throw "Syntax error, unrecognized expression: " + name;
3106
+ Sizzle.error( "Syntax error, unrecognized expression: " + name );
3042
3107
  }
3043
3108
  },
3044
3109
  CHILD: function(elem, match){
@@ -3540,7 +3605,7 @@ var winnow = function( elements, qualifier, keep ) {
3540
3605
  if ( isSimple.test( qualifier ) ) {
3541
3606
  return jQuery.filter(qualifier, filtered, !keep);
3542
3607
  } else {
3543
- qualifier = jQuery.filter( qualifier, elements );
3608
+ qualifier = jQuery.filter( qualifier, filtered );
3544
3609
  }
3545
3610
  }
3546
3611
 
@@ -3751,7 +3816,7 @@ jQuery.extend({
3751
3816
 
3752
3817
  dir: function( elem, dir, until ) {
3753
3818
  var matched = [], cur = elem[dir];
3754
- while ( cur && cur.nodeType !== 9 && (until === undefined || !jQuery( cur ).is( until )) ) {
3819
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
3755
3820
  if ( cur.nodeType === 1 ) {
3756
3821
  matched.push( cur );
3757
3822
  }
@@ -3792,6 +3857,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
3792
3857
  rtagName = /<([\w:]+)/,
3793
3858
  rtbody = /<tbody/i,
3794
3859
  rhtml = /<|&\w+;/,
3860
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
3795
3861
  fcloseTag = function( all, front, tag ) {
3796
3862
  return rselfClosing.test( tag ) ?
3797
3863
  all :
@@ -3822,7 +3888,7 @@ jQuery.fn.extend({
3822
3888
  if ( jQuery.isFunction(text) ) {
3823
3889
  return this.each(function(i) {
3824
3890
  var self = jQuery(this);
3825
- return self.text( text.call(this, i, self.text()) );
3891
+ self.text( text.call(this, i, self.text()) );
3826
3892
  });
3827
3893
  }
3828
3894
 
@@ -3863,6 +3929,12 @@ jQuery.fn.extend({
3863
3929
  },
3864
3930
 
3865
3931
  wrapInner: function( html ) {
3932
+ if ( jQuery.isFunction( html ) ) {
3933
+ return this.each(function(i) {
3934
+ jQuery(this).wrapInner( html.call(this, i) );
3935
+ });
3936
+ }
3937
+
3866
3938
  return this.each(function() {
3867
3939
  var self = jQuery( this ), contents = self.contents();
3868
3940
 
@@ -3976,11 +4048,13 @@ jQuery.fn.extend({
3976
4048
  (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
3977
4049
  !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
3978
4050
 
4051
+ value = value.replace(rxhtmlTag, fcloseTag);
4052
+
3979
4053
  try {
3980
4054
  for ( var i = 0, l = this.length; i < l; i++ ) {
3981
4055
  // Remove element nodes and prevent memory leaks
3982
4056
  if ( this[i].nodeType === 1 ) {
3983
- cleanData( this[i].getElementsByTagName("*") );
4057
+ jQuery.cleanData( this[i].getElementsByTagName("*") );
3984
4058
  this[i].innerHTML = value;
3985
4059
  }
3986
4060
  }
@@ -4011,6 +4085,12 @@ jQuery.fn.extend({
4011
4085
  // this can help fix replacing a parent with child elements
4012
4086
  if ( !jQuery.isFunction( value ) ) {
4013
4087
  value = jQuery( value ).detach();
4088
+
4089
+ } else {
4090
+ return this.each(function(i) {
4091
+ var self = jQuery(this), old = self.html();
4092
+ self.replaceWith( value.call( this, i, old ) );
4093
+ });
4014
4094
  }
4015
4095
 
4016
4096
  return this.each(function() {
@@ -4036,11 +4116,18 @@ jQuery.fn.extend({
4036
4116
  domManip: function( args, table, callback ) {
4037
4117
  var results, first, value = args[0], scripts = [];
4038
4118
 
4119
+ // We can't cloneNode fragments that contain checked, in WebKit
4120
+ if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
4121
+ return this.each(function() {
4122
+ jQuery(this).domManip( args, table, callback, true );
4123
+ });
4124
+ }
4125
+
4039
4126
  if ( jQuery.isFunction(value) ) {
4040
4127
  return this.each(function(i) {
4041
4128
  var self = jQuery(this);
4042
4129
  args[0] = value.call(this, i, table ? self.html() : undefined);
4043
- return self.domManip( args, table, callback );
4130
+ self.domManip( args, table, callback );
4044
4131
  });
4045
4132
  }
4046
4133
 
@@ -4109,16 +4196,16 @@ function cloneCopyEvent(orig, ret) {
4109
4196
  }
4110
4197
 
4111
4198
  function buildFragment( args, nodes, scripts ) {
4112
- var fragment, cacheable, cached, cacheresults, doc;
4199
+ var fragment, cacheable, cacheresults, doc;
4113
4200
 
4114
- if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 ) {
4201
+ // webkit does not clone 'checked' attribute of radio inputs on cloneNode, so don't cache if string has a checked
4202
+ if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
4115
4203
  cacheable = true;
4116
4204
  cacheresults = jQuery.fragments[ args[0] ];
4117
4205
  if ( cacheresults ) {
4118
4206
  if ( cacheresults !== 1 ) {
4119
4207
  fragment = cacheresults;
4120
4208
  }
4121
- cached = true;
4122
4209
  }
4123
4210
  }
4124
4211
 
@@ -4161,8 +4248,8 @@ jQuery.each({
4161
4248
  remove: function( selector, keepData ) {
4162
4249
  if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
4163
4250
  if ( !keepData && this.nodeType === 1 ) {
4164
- cleanData( this.getElementsByTagName("*") );
4165
- cleanData( [ this ] );
4251
+ jQuery.cleanData( this.getElementsByTagName("*") );
4252
+ jQuery.cleanData( [ this ] );
4166
4253
  }
4167
4254
 
4168
4255
  if ( this.parentNode ) {
@@ -4174,7 +4261,7 @@ jQuery.each({
4174
4261
  empty: function() {
4175
4262
  // Remove element nodes and prevent memory leaks
4176
4263
  if ( this.nodeType === 1 ) {
4177
- cleanData( this.getElementsByTagName("*") );
4264
+ jQuery.cleanData( this.getElementsByTagName("*") );
4178
4265
  }
4179
4266
 
4180
4267
  // Remove any remaining nodes
@@ -4281,16 +4368,15 @@ jQuery.extend({
4281
4368
  }
4282
4369
 
4283
4370
  return ret;
4284
- }
4285
- });
4286
-
4287
- function cleanData( elems ) {
4288
- for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
4289
- if ( !jQuery.noData[elem.nodeName.toLowerCase()] && (id = elem[expando]) ) {
4290
- delete jQuery.cache[ id ];
4371
+ },
4372
+
4373
+ cleanData: function( elems ) {
4374
+ for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
4375
+ jQuery.event.remove( elem );
4376
+ jQuery.removeData( elem );
4291
4377
  }
4292
4378
  }
4293
- }
4379
+ });
4294
4380
  // exclude the following css properties to add px
4295
4381
  var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
4296
4382
  ralpha = /alpha\([^)]*\)/,
@@ -4567,18 +4653,19 @@ jQuery.fn.extend({
4567
4653
  }
4568
4654
  }
4569
4655
 
4656
+ var self = this;
4657
+
4570
4658
  // Request the remote document
4571
4659
  jQuery.ajax({
4572
4660
  url: url,
4573
4661
  type: type,
4574
4662
  dataType: "html",
4575
4663
  data: params,
4576
- context:this,
4577
4664
  complete: function( res, status ) {
4578
4665
  // If successful, inject the HTML into all the matched elements
4579
4666
  if ( status === "success" || status === "notmodified" ) {
4580
4667
  // See if a selector was specified
4581
- this.html( selector ?
4668
+ self.html( selector ?
4582
4669
  // Create a dummy div to hold the results
4583
4670
  jQuery("<div />")
4584
4671
  // inject the contents of the document in, removing the scripts
@@ -4593,7 +4680,7 @@ jQuery.fn.extend({
4593
4680
  }
4594
4681
 
4595
4682
  if ( callback ) {
4596
- this.each( callback, [res.responseText, status, res] );
4683
+ self.each( callback, [res.responseText, status, res] );
4597
4684
  }
4598
4685
  }
4599
4686
  });
@@ -4727,7 +4814,7 @@ jQuery.extend({
4727
4814
  var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
4728
4815
 
4729
4816
  var jsonp, status, data,
4730
- callbackContext = s.context || s,
4817
+ callbackContext = origSettings && origSettings.context || s,
4731
4818
  type = s.type.toUpperCase();
4732
4819
 
4733
4820
  // convert data if not already a string
@@ -4913,7 +5000,7 @@ jQuery.extend({
4913
5000
  // Wait for a response to come back
4914
5001
  var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
4915
5002
  // The request was aborted
4916
- if ( !xhr || xhr.readyState === 0 ) {
5003
+ if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
4917
5004
  // Opera doesn't call onreadystatechange before this point
4918
5005
  // so we simulate the call
4919
5006
  if ( !requestDone ) {
@@ -4938,13 +5025,16 @@ jQuery.extend({
4938
5025
  "notmodified" :
4939
5026
  "success";
4940
5027
 
5028
+ var errMsg;
5029
+
4941
5030
  if ( status === "success" ) {
4942
5031
  // Watch for, and catch, XML document parse errors
4943
5032
  try {
4944
5033
  // process the data (runs the xml through httpData regardless of callback)
4945
5034
  data = jQuery.httpData( xhr, s.dataType, s );
4946
- } catch(e) {
5035
+ } catch(err) {
4947
5036
  status = "parsererror";
5037
+ errMsg = err;
4948
5038
  }
4949
5039
  }
4950
5040
 
@@ -4955,7 +5045,7 @@ jQuery.extend({
4955
5045
  success();
4956
5046
  }
4957
5047
  } else {
4958
- jQuery.handleError(s, xhr, status);
5048
+ jQuery.handleError(s, xhr, status, errMsg);
4959
5049
  }
4960
5050
 
4961
5051
  // Fire the complete handlers
@@ -4979,12 +5069,9 @@ jQuery.extend({
4979
5069
  xhr.abort = function() {
4980
5070
  if ( xhr ) {
4981
5071
  oldAbort.call( xhr );
4982
- if ( xhr ) {
4983
- xhr.readyState = 0;
4984
- }
4985
5072
  }
4986
5073
 
4987
- onreadystatechange();
5074
+ onreadystatechange( "abort" );
4988
5075
  };
4989
5076
  } catch(e) { }
4990
5077
 
@@ -5052,7 +5139,7 @@ jQuery.extend({
5052
5139
  handleError: function( s, xhr, status, e ) {
5053
5140
  // If a local callback was specified, fire it
5054
5141
  if ( s.error ) {
5055
- s.error.call( s.context || window, xhr, status, e );
5142
+ s.error.call( s.context || s, xhr, status, e );
5056
5143
  }
5057
5144
 
5058
5145
  // Fire the global callback
@@ -5100,7 +5187,7 @@ jQuery.extend({
5100
5187
  data = xml ? xhr.responseXML : xhr.responseText;
5101
5188
 
5102
5189
  if ( xml && data.documentElement.nodeName === "parsererror" ) {
5103
- throw "parsererror";
5190
+ jQuery.error( "parsererror" );
5104
5191
  }
5105
5192
 
5106
5193
  // Allow a pre-filtering function to sanitize the response
@@ -5113,23 +5200,7 @@ jQuery.extend({
5113
5200
  if ( typeof data === "string" ) {
5114
5201
  // Get the JavaScript object, if JSON is used.
5115
5202
  if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
5116
- // Make sure the incoming data is actual JSON
5117
- // Logic borrowed from http://json.org/json2.js
5118
- if (/^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
5119
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
5120
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) {
5121
-
5122
- // Try to use the native JSON parser first
5123
- if ( window.JSON && window.JSON.parse ) {
5124
- data = window.JSON.parse( data );
5125
-
5126
- } else {
5127
- data = (new Function("return " + data))();
5128
- }
5129
-
5130
- } else {
5131
- throw "Invalid JSON: " + data;
5132
- }
5203
+ data = jQuery.parseJSON( data );
5133
5204
 
5134
5205
  // If the type is "script", eval it in global context
5135
5206
  } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
@@ -5143,7 +5214,6 @@ jQuery.extend({
5143
5214
  // Serialize an array of form elements or a set of
5144
5215
  // key/values into a query string
5145
5216
  param: function( a, traditional ) {
5146
-
5147
5217
  var s = [];
5148
5218
 
5149
5219
  // Set traditional to true for jQuery <= 1.3.2 behavior.
@@ -5151,12 +5221,6 @@ jQuery.extend({
5151
5221
  traditional = jQuery.ajaxSettings.traditional;
5152
5222
  }
5153
5223
 
5154
- function add( key, value ) {
5155
- // If value is a function, invoke it and return its value
5156
- value = jQuery.isFunction(value) ? value() : value;
5157
- s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
5158
- }
5159
-
5160
5224
  // If an array was passed in, assume that it is an array of form elements.
5161
5225
  if ( jQuery.isArray(a) || a.jquery ) {
5162
5226
  // Serialize the form elements
@@ -5167,43 +5231,51 @@ jQuery.extend({
5167
5231
  } else {
5168
5232
  // If traditional, encode the "old" way (the way 1.3.2 or older
5169
5233
  // did it), otherwise encode params recursively.
5170
- jQuery.each( a, function buildParams( prefix, obj ) {
5171
-
5172
- if ( jQuery.isArray(obj) ) {
5173
- // Serialize array item.
5174
- jQuery.each( obj, function( i, v ) {
5175
- if ( traditional ) {
5176
- // Treat each array item as a scalar.
5177
- add( prefix, v );
5178
- } else {
5179
- // If array item is non-scalar (array or object), encode its
5180
- // numeric index to resolve deserialization ambiguity issues.
5181
- // Note that rack (as of 1.0.0) can't currently deserialize
5182
- // nested arrays properly, and attempting to do so may cause
5183
- // a server error. Possible fixes are to modify rack's
5184
- // deserialization algorithm or to provide an option or flag
5185
- // to force array serialization to be shallow.
5186
- buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
5187
- }
5188
- });
5189
-
5190
- } else if ( !traditional && obj != null && typeof obj === "object" ) {
5191
- // Serialize object item.
5192
- jQuery.each( obj, function( k, v ) {
5193
- buildParams( prefix + "[" + k + "]", v );
5194
- });
5195
-
5196
- } else {
5197
- // Serialize scalar item.
5198
- add( prefix, obj );
5199
- }
5200
- });
5234
+ for ( var prefix in a ) {
5235
+ buildParams( prefix, a[prefix] );
5236
+ }
5201
5237
  }
5202
-
5238
+
5203
5239
  // Return the resulting serialization
5204
5240
  return s.join("&").replace(r20, "+");
5205
- }
5206
5241
 
5242
+ function buildParams( prefix, obj ) {
5243
+ if ( jQuery.isArray(obj) ) {
5244
+ // Serialize array item.
5245
+ jQuery.each( obj, function( i, v ) {
5246
+ if ( traditional ) {
5247
+ // Treat each array item as a scalar.
5248
+ add( prefix, v );
5249
+ } else {
5250
+ // If array item is non-scalar (array or object), encode its
5251
+ // numeric index to resolve deserialization ambiguity issues.
5252
+ // Note that rack (as of 1.0.0) can't currently deserialize
5253
+ // nested arrays properly, and attempting to do so may cause
5254
+ // a server error. Possible fixes are to modify rack's
5255
+ // deserialization algorithm or to provide an option or flag
5256
+ // to force array serialization to be shallow.
5257
+ buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
5258
+ }
5259
+ });
5260
+
5261
+ } else if ( !traditional && obj != null && typeof obj === "object" ) {
5262
+ // Serialize object item.
5263
+ jQuery.each( obj, function( k, v ) {
5264
+ buildParams( prefix + "[" + k + "]", v );
5265
+ });
5266
+
5267
+ } else {
5268
+ // Serialize scalar item.
5269
+ add( prefix, obj );
5270
+ }
5271
+ }
5272
+
5273
+ function add( key, value ) {
5274
+ // If value is a function, invoke it and return its value
5275
+ value = jQuery.isFunction(value) ? value() : value;
5276
+ s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
5277
+ }
5278
+ }
5207
5279
  });
5208
5280
  var elemdisplay = {},
5209
5281
  rfxtypes = /toggle|show|hide/,
@@ -5220,7 +5292,7 @@ var elemdisplay = {},
5220
5292
 
5221
5293
  jQuery.fn.extend({
5222
5294
  show: function( speed, callback ) {
5223
- if ( speed != null ) {
5295
+ if ( speed || speed === 0) {
5224
5296
  return this.animate( genFx("show", 3), speed, callback);
5225
5297
 
5226
5298
  } else {
@@ -5264,7 +5336,7 @@ jQuery.fn.extend({
5264
5336
  },
5265
5337
 
5266
5338
  hide: function( speed, callback ) {
5267
- if ( speed != null ) {
5339
+ if ( speed || speed === 0 ) {
5268
5340
  return this.animate( genFx("hide", 3), speed, callback);
5269
5341
 
5270
5342
  } else {
@@ -5691,16 +5763,16 @@ if ( "getBoundingClientRect" in document.documentElement ) {
5691
5763
  jQuery.fn.offset = function( options ) {
5692
5764
  var elem = this[0];
5693
5765
 
5694
- if ( !elem || !elem.ownerDocument ) {
5695
- return null;
5696
- }
5697
-
5698
5766
  if ( options ) {
5699
5767
  return this.each(function( i ) {
5700
5768
  jQuery.offset.setOffset( this, options, i );
5701
5769
  });
5702
5770
  }
5703
5771
 
5772
+ if ( !elem || !elem.ownerDocument ) {
5773
+ return null;
5774
+ }
5775
+
5704
5776
  if ( elem === elem.ownerDocument.body ) {
5705
5777
  return jQuery.offset.bodyOffset( elem );
5706
5778
  }
@@ -5717,16 +5789,16 @@ if ( "getBoundingClientRect" in document.documentElement ) {
5717
5789
  jQuery.fn.offset = function( options ) {
5718
5790
  var elem = this[0];
5719
5791
 
5720
- if ( !elem || !elem.ownerDocument ) {
5721
- return null;
5722
- }
5723
-
5724
5792
  if ( options ) {
5725
5793
  return this.each(function( i ) {
5726
5794
  jQuery.offset.setOffset( this, options, i );
5727
5795
  });
5728
5796
  }
5729
5797
 
5798
+ if ( !elem || !elem.ownerDocument ) {
5799
+ return null;
5800
+ }
5801
+
5730
5802
  if ( elem === elem.ownerDocument.body ) {
5731
5803
  return jQuery.offset.bodyOffset( elem );
5732
5804
  }
@@ -5968,6 +6040,13 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
5968
6040
  if ( !elem ) {
5969
6041
  return size == null ? null : this;
5970
6042
  }
6043
+
6044
+ if ( jQuery.isFunction( size ) ) {
6045
+ return this.each(function( i ) {
6046
+ var self = jQuery( this );
6047
+ self[ type ]( size.call( this, i, self[ type ]() ) );
6048
+ });
6049
+ }
5971
6050
 
5972
6051
  return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
5973
6052
  // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jquery-source
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.0
5
+ version: 1.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel X. Moore