Ticket #5048: jquery.form.diff
File jquery.form.diff, 26.4 KB (added by , 17 years ago) |
---|
-
wp-includes/js/jquery/jquery.form.js
1 1 /* 2 * jQuery form plugin 3 * @requires jQuery v1.0.3 2 * jQuery Form Plugin 3 * version: 2.02 (12/16/2007) 4 * @requires jQuery v1.1 or later 4 5 * 6 * Examples at: http://malsup.com/jquery/form/ 5 7 * Dual licensed under the MIT and GPL licenses: 6 8 * http://www.opensource.org/licenses/mit-license.php 7 9 * http://www.gnu.org/licenses/gpl.html 8 10 * 9 11 * Revision: $Id$ 10 * Version: 0.911 12 */ 12 13 (function($) { 13 14 /** 14 15 * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX. 15 16 * … … 26 27 * url: URL to which the form data will be submitted. 27 28 * default value: value of form's 'action' attribute 28 29 * 29 * method: @deprecated use 'type'30 30 * type: The method in which the form data should be submitted, 'GET' or 'POST'. 31 31 * default value: value of form's 'method' attribute (or 'GET' if none found) 32 32 * 33 * before: @deprecated use 'beforeSubmit' 33 * data: Additional data to add to the request, specified as key/value pairs (see $.ajax). 34 * 34 35 * beforeSubmit: Callback method to be invoked before the form is submitted. 35 36 * default value: null 36 37 * 37 * after: @deprecated use 'success'38 38 * success: Callback method to be invoked after the form has been successfully submitted 39 39 * and the response has been returned from the server 40 40 * default value: null … … 66 66 * The dataType option provides a means for specifying how the server response should be handled. 67 67 * This maps directly to the jQuery.httpData method. The following values are supported: 68 68 * 69 * 'xml': if dataType == 'xml' the server response is treated as XML and the ' after'69 * 'xml': if dataType == 'xml' the server response is treated as XML and the 'success' 70 70 * callback method, if specified, will be passed the responseXML value 71 71 * 'json': if dataType == 'json' the server response will be evaluted and passed to 72 * the ' after' callback, if specified72 * the 'success' callback, if specified 73 73 * 'script': if dataType == 'script' the server response is evaluated in the global context 74 74 * 75 75 * … … 175 175 * @param options object literal containing options which control the form submission process 176 176 * @cat Plugins/Form 177 177 * @return jQuery 178 * @see formToArray179 * @see ajaxForm180 * @see $.ajax181 * @author jQuery Community182 178 */ 183 jQuery.fn.ajaxSubmit = function(options) {179 $.fn.ajaxSubmit = function(options) { 184 180 if (typeof options == 'function') 185 181 options = { success: options }; 186 182 187 options = jQuery.extend({188 url: this.attr('action') || '',189 method: this.attr('method') || 'GET'183 options = $.extend({ 184 url: this.attr('action') || window.location.toString(), 185 type: this.attr('method') || 'GET' 190 186 }, options || {}); 191 187 192 // remap deprecated options (temporarily) 193 options.success = options.success || options.after; 194 options.beforeSubmit = options.beforeSubmit || options.before; 195 options.type = options.type || options.method; 188 // hook for manipulating the form data before it is extracted; 189 // convenient for use with rich editors like tinyMCE or FCKEditor 190 var veto = {}; 191 $.event.trigger('form.pre.serialize', [this, options, veto]); 192 if (veto.veto) return this; 196 193 197 194 var a = this.formToArray(options.semantic); 195 if (options.data) { 196 for (var n in options.data) 197 a.push( { name: n, value: options.data[n] } ); 198 } 198 199 199 200 // give pre-submit callback an opportunity to abort the submit 200 201 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this; 201 202 202 var q = jQuery.param(a); 203 // fire vetoable 'validate' event 204 $.event.trigger('form.submit.validate', [a, this, options, veto]); 205 if (veto.veto) return this; 203 206 207 var q = $.param(a);//.replace(/%20/g,'+'); 208 204 209 if (options.type.toUpperCase() == 'GET') { 205 // if url already has a '?' then append args after '&'206 210 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; 207 211 options.data = null; // data is null for 'get' 208 212 } … … 216 220 // perform a load on the target only if dataType is not provided 217 221 if (!options.dataType && options.target) { 218 222 var oldSuccess = options.success || function(){}; 219 callbacks.push(function(data, status) { 220 jQuery(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, [data, status]); 223 callbacks.push(function(data) { 224 if (this.evalScripts) 225 $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments); 226 else // jQuery v1.1.4 227 $(options.target).html(data).each(oldSuccess, arguments); 221 228 }); 222 229 } 223 230 else if (options.success) … … 225 232 226 233 options.success = function(data, status) { 227 234 for (var i=0, max=callbacks.length; i < max; i++) 228 callbacks[i](data, status );235 callbacks[i](data, status, $form); 229 236 }; 230 237 231 jQuery.ajax(options); 238 // are there files to upload? 239 var files = $('input:file', this).fieldValue(); 240 var found = false; 241 for (var j=0; j < files.length; j++) 242 if (files[j]) 243 found = true; 244 245 // options.iframe allows user to force iframe mode 246 if (options.iframe || found) { 247 // hack to fix Safari hang (thanks to Tim Molendijk for this) 248 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d 249 if ($.browser.safari && options.closeKeepAlive) 250 $.get(options.closeKeepAlive, fileUpload); 251 else 252 fileUpload(); 253 } 254 else 255 $.ajax(options); 256 257 // fire 'notify' event 258 $.event.trigger('form.submit.notify', [this, options]); 232 259 return this; 260 261 262 // private function for handling file uploads (hat tip to YAHOO!) 263 function fileUpload() { 264 var form = $form[0]; 265 var opts = $.extend({}, $.ajaxSettings, options); 266 267 var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++; 268 var $io = $('<iframe id="' + id + '" name="' + id + '" />'); 269 var io = $io[0]; 270 var op8 = $.browser.opera && window.opera.version() < 9; 271 if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");'; 272 $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); 273 274 var xhr = { // mock object 275 responseText: null, 276 responseXML: null, 277 status: 0, 278 statusText: 'n/a', 279 getAllResponseHeaders: function() {}, 280 getResponseHeader: function() {}, 281 setRequestHeader: function() {} 282 }; 283 284 var g = opts.global; 285 // trigger ajax global events so that activity/block indicators work like normal 286 if (g && ! $.active++) $.event.trigger("ajaxStart"); 287 if (g) $.event.trigger("ajaxSend", [xhr, opts]); 288 289 var cbInvoked = 0; 290 var timedOut = 0; 291 292 // take a breath so that pending repaints get some cpu time before the upload starts 293 setTimeout(function() { 294 // make sure form attrs are set 295 var encAttr = form.encoding ? 'encoding' : 'enctype'; 296 var t = $form.attr('target'); 297 $form.attr({ 298 target: id, 299 method: 'POST', 300 action: opts.url 301 }); 302 form[encAttr] = 'multipart/form-data'; 303 304 // support timout 305 if (opts.timeout) 306 setTimeout(function() { timedOut = true; cb(); }, opts.timeout); 307 308 // add iframe to doc and submit the form 309 $io.appendTo('body'); 310 io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false); 311 form.submit(); 312 $form.attr('target', t); // reset target 313 }, 10); 314 315 function cb() { 316 if (cbInvoked++) return; 317 318 io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false); 319 320 var ok = true; 321 try { 322 if (timedOut) throw 'timeout'; 323 // extract the server response from the iframe 324 var data, doc; 325 doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document; 326 xhr.responseText = doc.body ? doc.body.innerHTML : null; 327 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 328 329 if (opts.dataType == 'json' || opts.dataType == 'script') { 330 var ta = doc.getElementsByTagName('textarea')[0]; 331 data = ta ? ta.value : xhr.responseText; 332 if (opts.dataType == 'json') 333 eval("data = " + data); 334 else 335 $.globalEval(data); 336 } 337 else if (opts.dataType == 'xml') { 338 data = xhr.responseXML; 339 if (!data && xhr.responseText != null) 340 data = toXml(xhr.responseText); 341 } 342 else { 343 data = xhr.responseText; 344 } 345 } 346 catch(e){ 347 ok = false; 348 $.handleError(opts, xhr, 'error', e); 349 } 350 351 // ordering of these callbacks/triggers is odd, but that's how $.ajax does it 352 if (ok) { 353 opts.success(data, 'success'); 354 if (g) $.event.trigger("ajaxSuccess", [xhr, opts]); 355 } 356 if (g) $.event.trigger("ajaxComplete", [xhr, opts]); 357 if (g && ! --$.active) $.event.trigger("ajaxStop"); 358 if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error'); 359 360 // clean up 361 setTimeout(function() { 362 $io.remove(); 363 xhr.responseXML = null; 364 }, 100); 365 }; 366 367 function toXml(s, doc) { 368 if (window.ActiveXObject) { 369 doc = new ActiveXObject('Microsoft.XMLDOM'); 370 doc.async = 'false'; 371 doc.loadXML(s); 372 } 373 else 374 doc = (new DOMParser()).parseFromString(s, 'text/xml'); 375 return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null; 376 }; 377 }; 233 378 }; 379 $.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids 234 380 235 381 /** 236 382 * ajaxForm() provides a mechanism for fully automating form submission. … … 289 435 * @return jQuery 290 436 * @cat Plugins/Form 291 437 * @type jQuery 292 * @see ajaxSubmit293 * @author jQuery Community294 438 */ 295 jQuery.fn.ajaxForm = function(options) { 296 return this.each(function() { 297 jQuery("input:submit,input:image,button:submit", this).click(function(ev) { 298 var $form = this.form; 299 $form.clk = this; 300 if (this.type == 'image') { 301 if (ev.offsetX != undefined) { 302 $form.clk_x = ev.offsetX; 303 $form.clk_y = ev.offsetY; 304 } else if (typeof jQuery.fn.offset == 'function') { // try to use dimensions plugin 305 var offset = jQuery(this).offset(); 306 $form.clk_x = ev.pageX - offset.left; 307 $form.clk_y = ev.pageY - offset.top; 308 } else { 309 $form.clk_x = ev.pageX - this.offsetLeft; 310 $form.clk_y = ev.pageY - this.offsetTop; 311 } 312 } 313 // clear form vars 314 setTimeout(function() { 315 $form.clk = $form.clk_x = $form.clk_y = null; 316 }, 10); 317 }) 318 }).submit(function(e) { 319 jQuery(this).ajaxSubmit(options); 320 return false; 439 $.fn.ajaxForm = function(options) { 440 return this.ajaxFormUnbind().submit(submitHandler).each(function() { 441 // store options in hash 442 this.formPluginId = $.fn.ajaxForm.counter++; 443 $.fn.ajaxForm.optionHash[this.formPluginId] = options; 444 $(":submit,input:image", this).click(clickHandler); 321 445 }); 322 446 }; 323 447 448 $.fn.ajaxForm.counter = 1; 449 $.fn.ajaxForm.optionHash = {}; 324 450 451 function clickHandler(e) { 452 var $form = this.form; 453 $form.clk = this; 454 if (this.type == 'image') { 455 if (e.offsetX != undefined) { 456 $form.clk_x = e.offsetX; 457 $form.clk_y = e.offsetY; 458 } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin 459 var offset = $(this).offset(); 460 $form.clk_x = e.pageX - offset.left; 461 $form.clk_y = e.pageY - offset.top; 462 } else { 463 $form.clk_x = e.pageX - this.offsetLeft; 464 $form.clk_y = e.pageY - this.offsetTop; 465 } 466 } 467 // clear form vars 468 setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10); 469 }; 470 471 function submitHandler() { 472 // retrieve options from hash 473 var id = this.formPluginId; 474 var options = $.fn.ajaxForm.optionHash[id]; 475 $(this).ajaxSubmit(options); 476 return false; 477 }; 478 325 479 /** 480 * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm 481 * 482 * @name ajaxFormUnbind 483 * @return jQuery 484 * @cat Plugins/Form 485 * @type jQuery 486 */ 487 $.fn.ajaxFormUnbind = function() { 488 this.unbind('submit', submitHandler); 489 return this.each(function() { 490 $(":submit,input:image", this).unbind('click', clickHandler); 491 }); 492 493 }; 494 495 /** 326 496 * formToArray() gathers form element data into an array of objects that can 327 497 * be passed to any of the following ajax functions: $.get, $.post, or load. 328 498 * Each object in the array has both a 'name' and 'value' property. An example of … … 347 517 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower) 348 518 * @type Array<Object> 349 519 * @cat Plugins/Form 350 * @see ajaxForm351 * @see ajaxSubmit352 * @author jQuery Community353 520 */ 354 jQuery.fn.formToArray = function(semantic) {521 $.fn.formToArray = function(semantic) { 355 522 var a = []; 356 523 if (this.length == 0) return a; 357 524 … … 369 536 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 370 537 continue; 371 538 } 372 var v = jQuery.fieldValue(el, true); 373 if (v === null) continue;374 if (v .constructor == Array) {539 540 var v = $.fieldValue(el, true); 541 if (v && v.constructor == Array) { 375 542 for(var j=0, jmax=v.length; j < jmax; j++) 376 543 a.push({name: n, value: v[j]}); 377 544 } 378 else 545 else if (v !== null && typeof v != 'undefined') 379 546 a.push({name: n, value: v}); 380 547 } 381 548 … … 410 577 * @param semantic true if serialization must maintain strict semantic ordering of elements (slower) 411 578 * @type String 412 579 * @cat Plugins/Form 413 * @see formToArray414 * @author jQuery Community415 580 */ 416 jQuery.fn.formSerialize = function(semantic) {581 $.fn.formSerialize = function(semantic) { 417 582 //hand off to jQuery.param for proper encoding 418 return jQuery.param(this.formToArray(semantic));583 return $.param(this.formToArray(semantic)); 419 584 }; 420 585 421 586 … … 447 612 * @type String 448 613 * @cat Plugins/Form 449 614 */ 450 jQuery.fn.fieldSerialize = function(successful) {615 $.fn.fieldSerialize = function(successful) { 451 616 var a = []; 452 617 this.each(function() { 453 618 var n = this.name; 454 619 if (!n) return; 455 var v = jQuery.fieldValue(this, successful);620 var v = $.fieldValue(this, successful); 456 621 if (v && v.constructor == Array) { 457 622 for (var i=0,max=v.length; i < max; i++) 458 623 a.push({name: n, value: v[i]}); … … 461 626 a.push({name: this.name, value: v}); 462 627 }); 463 628 //hand off to jQuery.param for proper encoding 464 return jQuery.param(a);629 return $.param(a); 465 630 }; 466 631 467 632 468 633 /** 469 * Returns the value of the field element in the jQuery object. If there is more than one field element 470 * in the jQuery object the value of the first successful one is returned. 634 * Returns the value(s) of the element in the matched set. For example, consider the following form: 471 635 * 636 * <form><fieldset> 637 * <input name="A" type="text" /> 638 * <input name="A" type="text" /> 639 * <input name="B" type="checkbox" value="B1" /> 640 * <input name="B" type="checkbox" value="B2"/> 641 * <input name="C" type="radio" value="C1" /> 642 * <input name="C" type="radio" value="C2" /> 643 * </fieldset></form> 644 * 645 * var v = $(':text').fieldValue(); 646 * // if no values are entered into the text inputs 647 * v == ['',''] 648 * // if values entered into the text inputs are 'foo' and 'bar' 649 * v == ['foo','bar'] 650 * 651 * var v = $(':checkbox').fieldValue(); 652 * // if neither checkbox is checked 653 * v === undefined 654 * // if both checkboxes are checked 655 * v == ['B1', 'B2'] 656 * 657 * var v = $(':radio').fieldValue(); 658 * // if neither radio is checked 659 * v === undefined 660 * // if first radio is checked 661 * v == ['C1'] 662 * 472 663 * The successful argument controls whether or not the field element must be 'successful' 473 664 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 474 * The default value of the successful argument is true. If this value is false the n475 * the value of the first field element in the jQuery object is returned.665 * The default value of the successful argument is true. If this value is false the value(s) 666 * for each element is returned. 476 667 * 477 * Note: If no valid value can be determined the return value will be undifined. 668 * Note: This method *always* returns an array. If no valid value can be determined the 669 * array will be empty, otherwise it will contain one or more values. 478 670 * 479 * Note: The fieldValue returned for a select-multiple element or for a checkbox input will 480 * always be an array if it is not undefined. 671 * @example var data = $("#myPasswordElement").fieldValue(); 672 * alert(data[0]); 673 * @desc Alerts the current value of the myPasswordElement element 481 674 * 675 * @example var data = $("#myForm :input").fieldValue(); 676 * @desc Get the value(s) of the form elements in myForm 482 677 * 483 * @example var data = $("#my PasswordElement").formValue();484 * @desc Get s the current value of the myPasswordElement element678 * @example var data = $("#myForm :checkbox").fieldValue(); 679 * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object. 485 680 * 486 * @example var data = $("#my Form :input").formValue();487 * @desc Get the value of the first successful control in the jQuery object.681 * @example var data = $("#mySingleSelect").fieldValue(); 682 * @desc Get the value(s) of the select control 488 683 * 489 * @example var data = $( "#myForm :checkbox").formValue();490 * @desc Get the array of values for the first set of successful checkbox controls in the jQuery object.684 * @example var data = $(':text').fieldValue(); 685 * @desc Get the value(s) of the text input or textarea elements 491 686 * 492 * @example var data = $("#my SingleSelect").formValue();493 * @desc Get the value of the selectcontrol687 * @example var data = $("#myMultiSelect").fieldValue(); 688 * @desc Get the values for the select-multiple control 494 689 * 495 * @example var data = $("#myMultiSelect").formValue();496 * @desc Get the array of selected values for the select-multiple control497 *498 690 * @name fieldValue 499 * @param Boolean successful true if value returned must be for a successful controls(default is true)500 * @type String orArray<String>691 * @param Boolean successful true if only the values for successful controls should be returned (default is true) 692 * @type Array<String> 501 693 * @cat Plugins/Form 502 694 */ 503 jQuery.fn.fieldValue = function(successful) { 504 var cbVal, cbName; 505 506 // loop until we find a value 507 for (var i=0, max=this.length; i < max; i++) { 695 $.fn.fieldValue = function(successful) { 696 for (var val=[], i=0, max=this.length; i < max; i++) { 508 697 var el = this[i]; 509 var v = jQuery.fieldValue(el, successful);698 var v = $.fieldValue(el, successful); 510 699 if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) 511 700 continue; 512 513 // for checkboxes, consider multiple elements, for everything else just return first valid value 514 if (el.type != 'checkbox') return v; 515 516 cbName = cbName || el.name; 517 if (cbName != el.name) // return if we hit a checkbox with a different name 518 return cbVal; 519 cbVal = cbVal || []; 520 cbVal.push(v); 701 v.constructor == Array ? $.merge(val, v) : val.push(v); 521 702 } 522 return cbVal;703 return val; 523 704 }; 524 705 525 706 /** … … 530 711 * The default value of the successful argument is true. If the given element is not 531 712 * successful and the successful arg is not false then the returned value will be null. 532 713 * 533 * Note: The fieldValue returned for a select-multiple element will always be an array. 714 * Note: If the successful flag is true (default) but the element is not successful, the return will be null 715 * Note: The value returned for a successful select-multiple element will always be an array. 716 * Note: If the element has no value the return value will be undefined. 534 717 * 535 718 * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]); 536 719 * @desc Gets the current value of the myPasswordElement element … … 538 721 * @name fieldValue 539 722 * @param Element el The DOM element for which the value will be returned 540 723 * @param Boolean successful true if value returned must be for a successful controls (default is true) 541 * @type String or Array<String> 724 * @type String or Array<String> or null or undefined 542 725 * @cat Plugins/Form 543 726 */ 544 jQuery.fieldValue = function(el, successful) {727 $.fieldValue = function(el, successful) { 545 728 var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); 546 729 if (typeof successful == 'undefined') successful = true; 547 730 548 if (successful && ( !n || el.disabled || t == 'reset' ||731 if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || 549 732 (t == 'checkbox' || t == 'radio') && !el.checked || 550 733 (t == 'submit' || t == 'image') && el.form && el.form.clk != el || 551 734 tag == 'select' && el.selectedIndex == -1)) … … 561 744 var op = ops[i]; 562 745 if (op.selected) { 563 746 // extra pain for IE... 564 var v = jQuery.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;747 var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value; 565 748 if (one) return v; 566 749 a.push(v); 567 750 } … … 586 769 * @name clearForm 587 770 * @type jQuery 588 771 * @cat Plugins/Form 589 * @see resetForm590 772 */ 591 jQuery.fn.clearForm = function() {773 $.fn.clearForm = function() { 592 774 return this.each(function() { 593 jQuery('input,select,textarea', this).clearFields();775 $('input,select,textarea', this).clearFields(); 594 776 }); 595 777 }; 596 778 … … 608 790 * @name clearFields 609 791 * @type jQuery 610 792 * @cat Plugins/Form 611 * @see clearForm612 793 */ 613 jQuery.fn.clearFields = jQuery.fn.clearInputs = function() {794 $.fn.clearFields = $.fn.clearInputs = function() { 614 795 return this.each(function() { 615 796 var t = this.type, tag = this.tagName.toLowerCase(); 616 797 if (t == 'text' || t == 'password' || tag == 'textarea') … … 632 813 * @name resetForm 633 814 * @type jQuery 634 815 * @cat Plugins/Form 635 * @see clearForm636 816 */ 637 jQuery.fn.resetForm = function() {817 $.fn.resetForm = function() { 638 818 return this.each(function() { 639 819 // guard against an input with the name of 'reset' 640 820 // note that IE reports the reset function as an 'object' … … 642 822 this.reset(); 643 823 }); 644 824 }; 825 826 827 /** 828 * Enables or disables any matching elements. 829 * 830 * @example $(':radio').enabled(false); 831 * @desc Disables all radio buttons 832 * 833 * @name select 834 * @type jQuery 835 * @cat Plugins/Form 836 */ 837 $.fn.enable = function(b) { 838 if (b == undefined) b = true; 839 return this.each(function() { 840 this.disabled = !b 841 }); 842 }; 843 844 /** 845 * Checks/unchecks any matching checkboxes or radio buttons and 846 * selects/deselects and matching option elements. 847 * 848 * @example $(':checkbox').selected(); 849 * @desc Checks all checkboxes 850 * 851 * @name select 852 * @type jQuery 853 * @cat Plugins/Form 854 */ 855 $.fn.select = function(select) { 856 if (select == undefined) select = true; 857 return this.each(function() { 858 var t = this.type; 859 if (t == 'checkbox' || t == 'radio') 860 this.checked = select; 861 else if (this.tagName.toLowerCase() == 'option') { 862 var $sel = $(this).parent('select'); 863 if (select && $sel[0] && $sel[0].type == 'select-one') { 864 // deselect all other options 865 $sel.find('option').select(false); 866 } 867 this.selected = select; 868 } 869 }); 870 }; 871 872 })(jQuery); -
wp-includes/script-loader.php
78 78 $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118'); 79 79 80 80 $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.2b2'); 81 $this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), ' 1.0.3');81 $this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02'); 82 82 $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' ); 83 83 $this->add( 'dimensions', '/wp-includes/js/jquery/jquery.dimensions.min.js', array('jquery'), '1.1.2'); 84 84 $this->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('dimensions'), '1.1');