Changeset 4187
- Timestamp:
- 12/16/07 17:15:27 (1 year ago)
- Location:
- trunk/plugins
- Files:
-
- 1 added
- 5 modified
-
ajaxQueue/jquery.ajaxQueue.js (modified) (1 diff)
-
ajaxQueue/test/index.html (modified) (1 diff)
-
ajaxQueue/test/jquery.js (added)
-
ajaxQueue/test/testrunner.js (modified) (4 diffs)
-
metadata/jquery.metadata.js (modified) (1 diff)
-
metadata/test/jquery.js (modified) (87 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/ajaxQueue/jquery.ajaxQueue.js
r4186 r4187 77 77 ajax( settings ); 78 78 }); 79 return ;79 return undefined; 80 80 case "sync": 81 81 var pos = synced.length; -
trunk/plugins/ajaxQueue/test/index.html
r3255 r4187 6 6 7 7 <link rel="stylesheet" href="testsuite.css"/> 8 <script type="text/javascript" src=" ../../../jquery/dist/jquery.js"></script>8 <script type="text/javascript" src="jquery.js"></script> 9 9 <script type="text/javascript" src="../jquery.ajaxQueue.js"></script> 10 <script type="text/javascript" src=" ../../../jquery/test/data/testrunner.js"></script>10 <script type="text/javascript" src="testrunner.js"></script> 11 11 <script type="text/javascript" src="test.js"></script> 12 12 <style type="text/css"> -
trunk/plugins/ajaxQueue/test/testrunner.js
r2841 r4187 75 75 76 76 var filter = location.search.slice(1); 77 if ( filter && encodeURIComponent(name) != filter)77 if ( filter && encodeURIComponent(name).indexOf(filter) == -1 ) 78 78 return; 79 79 … … 89 89 } 90 90 _config.Test.push( [ false, "Died on test #" + (_config.Test.length+1) + ": " + e ] ); 91 throw e;92 91 } 93 92 }); … … 163 162 */ 164 163 function reset() { 165 document.getElementById('main').innerHTML = _config.fixture;164 $("#main").html( _config.fixture ); 166 165 } 167 166 … … 275 274 * @example equals( "Expected 2 characters.", v.formatMessage("Expected {0} characters.", 2) ); 276 275 * 276 * @param Object actual 277 277 * @param Object expected 278 * @param Object actual279 278 * @param String message (optional) 280 279 */ -
trunk/plugins/metadata/jquery.metadata.js
r3640 r4187 85 85 data = m[1]; 86 86 } else if ( settings.type == "elem" ) { 87 if( !elem.getElementsByTagName ) return; 87 if( !elem.getElementsByTagName ) 88 return undefined; 88 89 var e = elem.getElementsByTagName(settings.name); 89 90 if ( e.length ) -
trunk/plugins/metadata/test/jquery.js
r3640 r4187 1 1 (function(){ 2 2 /* 3 * jQuery @VERSION- New Wave Javascript3 * jQuery 1.2.2-pre - New Wave Javascript 4 4 * 5 5 * Copyright (c) 2007 John Resig (jquery.com) … … 7 7 * and GPL (GPL-LICENSE.txt) licenses. 8 8 * 9 * $Date: 2007-1 0-01 22:15:20 +0200 (Mo, 01 Okt2007) $10 * $Rev: 3501 $9 * $Date: 2007-12-16 02:03:50 +0100 (Son, 16 Dez 2007) $ 10 * $Rev: 4171 $ 11 11 */ 12 12 13 13 // Map over jQuery in case of overwrite 14 if ( typeof jQuery != "undefined")15 var _jQuery = jQuery;14 if ( window.jQuery ) 15 var _jQuery = window.jQuery; 16 16 17 17 var jQuery = window.jQuery = function( selector, context ) { 18 // If the context is a namespace object, return a new object 19 return this instanceof jQuery ? 20 this.init( selector, context ) : 21 new jQuery( selector, context ); 18 // The jQuery object is actually just the init constructor 'enhanced' 19 return new jQuery.prototype.init( selector, context ); 22 20 }; 23 21 24 22 // Map over the $ in case of overwrite 25 if ( typeof $ != "undefined")26 var _$ = $;23 if ( window.$ ) 24 var _$ = window.$; 27 25 28 26 // Map the jQuery namespace to the '$' one … … 32 30 // (both of which we optimize for) 33 31 var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; 32 33 // Is it a simple selector 34 var isSimple = /^.[^:#\[\.]*$/; 34 35 35 36 jQuery.fn = jQuery.prototype = { … … 38 39 selector = selector || document; 39 40 41 // Handle $(DOMElement) 42 if ( selector.nodeType ) { 43 this[0] = selector; 44 this.length = 1; 45 return this; 46 40 47 // Handle HTML strings 41 if ( typeof selector== "string" ) {48 } else if ( typeof selector == "string" ) { 42 49 // Are we dealing with HTML string or an ID? 43 50 var match = quickExpr.exec( selector ); … … 190 197 191 198 css: function( key, value ) { 199 // ignore negative width and height values 200 if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) 201 value = undefined; 192 202 return this.attr( key, value, "curCSS" ); 193 203 }, … … 195 205 text: function( text ) { 196 206 if ( typeof text != "object" && text != null ) 197 return this.empty().append( document.createTextNode( text ) );207 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); 198 208 199 209 var ret = ""; … … 244 254 append: function() { 245 255 return this.domManip(arguments, true, false, function(elem){ 246 this.appendChild( elem ); 256 if (this.nodeType == 1) 257 this.appendChild( elem ); 247 258 }); 248 259 }, … … 250 261 prepend: function() { 251 262 return this.domManip(arguments, true, true, function(elem){ 252 this.insertBefore( elem, this.firstChild ); 263 if (this.nodeType == 1) 264 this.insertBefore( elem, this.firstChild ); 253 265 }); 254 266 }, … … 283 295 // Do the clone 284 296 var ret = this.map(function(){ 285 return this.outerHTML ? 286 jQuery( this.outerHTML )[0] : 287 this.cloneNode( true ); 297 if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { 298 // IE copies events bound via attachEvent when 299 // using cloneNode. Calling detachEvent on the 300 // clone will also remove the events from the orignal 301 // In order to get around this, we use innerHTML. 302 // Unfortunately, this means some modifications to 303 // attributes in IE that are actually only stored 304 // as properties will not be copied (such as the 305 // the name attribute on an input). 306 var clone = this.cloneNode(true), 307 container = document.createElement("div"), 308 container2 = document.createElement("div"); 309 container.appendChild(clone); 310 container2.innerHTML = container.innerHTML; 311 return container2.firstChild; 312 } else 313 return this.cloneNode(true); 288 314 }); 289 315 … … 321 347 322 348 not: function( selector ) { 323 return this.pushStack( 324 selector.constructor == String && 325 jQuery.multiFilter( selector, this, true ) || 326 327 jQuery.grep(this, function(elem) { 328 return selector.constructor == Array || selector.jquery ? 329 jQuery.inArray( elem, selector ) < 0 : 330 elem != selector; 331 }) ); 349 if ( selector.constructor == String ) 350 // test special case where just one selector is passed in 351 if ( isSimple.test( selector ) ) 352 return this.pushStack( jQuery.multiFilter( selector, this, true ) ); 353 else 354 selector = jQuery.multiFilter( selector, this ); 355 356 return this.filter(function() { 357 return jQuery.inArray( this, selector ) < 0; 358 }); 332 359 }, 333 360 334 361 add: function( selector ) { 335 return this.pushStack( jQuery.merge( this.get(), jQuery( selector ) ) ); 362 return !selector ? this : this.pushStack( jQuery.merge( 363 this.get(), 364 selector.constructor == String ? 365 jQuery( selector ).get() : 366 selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? 367 selector : [selector] ) ); 336 368 }, 337 369 … … 351 383 if ( this.length ) { 352 384 var elem = this[0]; 353 385 354 386 // We need to handle select boxes special 355 387 if ( jQuery.nodeName( elem, "select" ) ) { … … 384 416 // Everything else, we just grab the value 385 417 } else 386 return this[0].value.replace(/\r/g, ""); 387 388 } 389 390 } else 391 return this.each(function(){ 392 if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) 393 this.checked = (jQuery.inArray(this.value, value) >= 0 || 394 jQuery.inArray(this.name, value) >= 0); 395 396 else if ( jQuery.nodeName( this, "select" ) ) { 397 var values = value.constructor == Array ? 398 value : 399 [ value ]; 400 401 jQuery( "option", this ).each(function(){ 402 this.selected = (jQuery.inArray( this.value, values ) >= 0 || 403 jQuery.inArray( this.text, values ) >= 0); 404 }); 405 406 if ( !tmp.length ) 407 this.selectedIndex = -1; 408 409 } else 410 this.value = value; 411 }); 418 return (this[0].value || "").replace(/\r/g, ""); 419 420 } 421 422 } 423 424 return this.each(function(){ 425 if ( this.nodeType != 1 ) 426 return; 427 428 if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) 429 this.checked = (jQuery.inArray(this.value, value) >= 0 || 430 jQuery.inArray(this.name, value) >= 0); 431 432 else if ( jQuery.nodeName( this, "select" ) ) { 433 var values = value.constructor == Array ? 434 value : 435 [ value ]; 436 437 jQuery( "option", this ).each(function(){ 438 this.selected = (jQuery.inArray( this.value, values ) >= 0 || 439 jQuery.inArray( this.text, values ) >= 0); 440 }); 441 442 if ( !values.length ) 443 this.selectedIndex = -1; 444 445 } else 446 this.value = value; 447 }); 412 448 }, 413 449 … … 456 492 457 493 if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) 458 obj = this.getElementsByTagName("tbody")[0] || this.appendChild( document.createElement("tbody") ); 494 obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); 495 496 var scripts = jQuery( [] ); 459 497 460 498 jQuery.each(elems, function(){ … … 463 501 this; 464 502 465 if ( !evalScript( 0, elem ) ) 503 // execute all scripts after the elements have been injected 504 if ( jQuery.nodeName( elem, "script" ) ) { 505 scripts = scripts.add( elem ); 506 } else { 507 // Remove any inner scripts for later evaluation 508 if ( elem.nodeType == 1 ) 509 scripts = scripts.add( jQuery( "script", elem ).remove() ); 510 511 // Inject the elements into the document 466 512 callback.call( obj, elem ); 513 } 467 514 }); 515 516 scripts.each( evalScript ); 468 517 }); 469 518 } 470 519 }; 471 520 521 // Give the init function the jQuery prototype for later instantiation 522 jQuery.prototype.init.prototype = jQuery.prototype; 523 472 524 function evalScript( i, elem ) { 473 var script = jQuery.nodeName( elem, "script" ); 474 475 if ( script ) { 476 if ( elem.src ) 477 jQuery.ajax({ 478 url: elem.src, 479 async: false, 480 dataType: "script" 481 }); 482 483 else 484 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); 485 486 if ( elem.parentNode ) 487 elem.parentNode.removeChild( elem ); 488 489 } else if ( elem.nodeType == 1 ) 490 jQuery( "script", elem ).each( evalScript ); 491 492 return script; 525 if ( elem.src ) 526 jQuery.ajax({ 527 url: elem.src, 528 async: false, 529 dataType: "script" 530 }); 531 532 else 533 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); 534 535 if ( elem.parentNode ) 536 elem.parentNode.removeChild( elem ); 493 537 } 494 538 … … 501 545 deep = target; 502 546 target = arguments[1] || {}; 547 // skip the boolean and the target 548 i = 2; 503 549 } 550 551 // Handle case when target is a string or something (possible in deep copy) 552 if ( typeof target != "object" && typeof target != "function" ) 553 target = {}; 504 554 505 555 // extend jQuery itself if only one argument is passed … … 515 565 for ( var name in options ) { 516 566 // Prevent never-ending loop 517 if ( target == options[ name ] )567 if ( target === options[ name ] ) 518 568 continue; 519 569 520 570 // Recurse if we're merging object values 521 if ( deep && typeof options[ name ] == "object" && target[ name ])522 jQuery.extend( target[ name ], options[ name ] );571 if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType ) 572 target[ name ] = jQuery.extend( target[ name ], options[ name ] ); 523 573 524 574 // Don't bring in undefined values … … 561 611 562 612 // Evalulates a script in a global context 563 // Evaluates Async. in Safari 2 :-(564 613 globalEval: function( data ) { 565 614 data = jQuery.trim( data ); … … 693 742 add: function( elem, classNames ) { 694 743 jQuery.each((classNames || "").split(/\s+/), function(i, className){ 695 if ( !jQuery.className.has( elem.className, className ) )744 if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) 696 745 elem.className += (elem.className ? " " : "") + className; 697 746 }); … … 700 749 // internal only, use removeClass("class") 701 750 remove: function( elem, classNames ) { 702 elem.className = classNames != undefined ? 703 jQuery.grep(elem.className.split(/\s+/), function(className){ 704 return !jQuery.className.has( classNames, className ); 705 }).join(" ") : 706 ""; 751 if (elem.nodeType == 1) 752 elem.className = classNames != undefined ? 753 jQuery.grep(elem.className.split(/\s+/), function(className){ 754 return !jQuery.className.has( classNames, className ); 755 }).join(" ") : 756 ""; 707 757 }, 708 758 … … 728 778 }, 729 779 730 css: function( elem, name ) { 731 if ( name == "height" || name == "width" ) { 732 var old = {}, height, width; 733 734 // Revert the padding and border widths to get the 735 // correct height/width values 736 jQuery.each([ "Top", "Bottom", "Right", "Left" ], function(){ 737 old[ "padding" + this ] = 0; 738 old[ "border" + this + "Width" ] = 0; 739 }); 740 741 // Swap out the padding/border values temporarily 742 jQuery.swap( elem, old, function() { 743 744 // If the element is visible, then the calculation is easy 745 if ( jQuery( elem ).is(":visible") ) { 746 height = elem.offsetHeight; 747 width = elem.offsetWidth; 748 749 // Otherwise, we need to flip out more values 750 } else { 751 elem = jQuery( elem.cloneNode(true) ) 752 .find(":radio").removeAttr("checked").end() 753 .css({ 754 visibility: "hidden", 755 position: "absolute", 756 display: "block", 757 right: "0", 758 left: "0" 759 }).appendTo( elem.parentNode )[0]; 760 761 var position = jQuery.css( elem.parentNode, "position" ) || "static"; 762 if ( position == "static" ) 763 elem.parentNode.style.position = "relative"; 764 765 height = elem.clientHeight; 766 width = elem.clientWidth; 767 768 if ( position == "static" ) 769 elem.parentNode.style.position = "static"; 770 771 elem.parentNode.removeChild( elem ); 772 } 773 }); 774 775 return name == "height" ? 776 height : 777 width; 778 } 779 780 return jQuery.curCSS( elem, name ); 780 css: function( elem, name, force ) { 781 if ( name == "width" || name == "height" ) { 782 var width, height, props = { position: "absolute", visibility: "hidden", display:"block" }; 783 784 function getWH() { 785 width = elem.clientWidth; 786 height = elem.clientHeight; 787 } 788 789 if ( jQuery(elem).is(":visible") ) 790 getWH(); 791 else 792 jQuery.swap( elem, props, getWH ); 793 794 return name == "width" ? width : height; 795 } 796 797 return jQuery.curCSS( elem, name, force ); 781 798 }, 782 799 … … 843 860 ret = name == "display" && swap[ stack.length - 1 ] != null ? 844 861 "none" : 845 document.defaultView.getComputedStyle( elem, null ).getPropertyValue( name) || "";862 ( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || ""; 846 863 847 864 // Finally, revert the display styles back … … 888 905 var ret = []; 889 906 context = context || document; 907 // !context.createElement fails in IE with an error but returns typeof 'object' 908 if (typeof context.createElement == 'undefined') 909 context = context.ownerDocument || context[0] && context[0].ownerDocument || document; 890 910 891 911 jQuery.each(elems, function(i, elem){ … … 911 931 // option or optgroup 912 932 !tags.indexOf("<opt") && 913 [ 1, "<select >", "</select>" ] ||933 [ 1, "<select multiple='multiple'>", "</select>" ] || 914 934 915 935 !tags.indexOf("<leg") && … … 950 970 951 971 // String was a bare <thead> or <tfoot> 952 wrap[1] == "<table>" && s.indexOf("<tbody") < 0 ?972 wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? 953 973 div.childNodes : 954 974 []; 955 956 for ( var i = tbody.length - 1; i >= 0 ; --i)957 if ( jQuery.nodeName( tbody[ i ], "tbody" ) && !tbody[ i].childNodes.length )958 tbody[ i ].parentNode.removeChild( tbody[ i] );959 975 976 for ( var j = tbody.length - 1; j >= 0 ; --j ) 977 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) 978 tbody[ j ].parentNode.removeChild( tbody[ j ] ); 979 960 980 // IE completely kills leading whitespace when innerHTML is used 961 981 if ( /^\s/.test( elem ) ) 962 982 div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); 963 983 964 984 } 965 985 … … 982 1002 983 1003 attr: function( elem, name, value ) { 1004 // don't set attributes on text and comment nodes 1005 if (!elem || elem.nodeType == 3 || elem.nodeType == 8) 1006 return undefined; 1007 984 1008 var fix = jQuery.isXMLDoc( elem ) ? 985 1009 {} : … … 1012 1036 throw "type property can't be changed"; 1013 1037 1014 elem.setAttribute( name, value ); 1038 // convert the value to a string (all browsers do this but IE) see #1070 1039 elem.setAttribute( name, "" + value ); 1015 1040 } 1016 1041 … … 1034 1059 } 1035 1060 1036 return elem.filter ?1061 return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? 1037 1062 (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : 1038 1063 ""; … … 1184 1209 selected: "selected", 1185 1210 maxlength: "maxLength", 1186 selectedIndex: "selectedIndex" 1211 selectedIndex: "selectedIndex", 1212 defaultValue: "defaultValue", 1213 tagName: "tagName", 1214 nodeName: "nodeName" 1187 1215 } 1188 1216 }); … … 1231 1259 removeAttr: function( name ) { 1232 1260 jQuery.attr( this, name, "" ); 1233 this.removeAttribute( name ); 1261 if (this.nodeType == 1) 1262 this.removeAttribute( name ); 1234 1263 }, 1235 1264 … … 1248 1277 remove: function( selector ) { 1249 1278 if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { 1250
