From 20a34856637b43c13eb92d3a50663421170f1f32 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Thu, 27 Oct 2011 15:20:47 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- 1.2.3/dist/jquery.js | 406 ++++++++--------- 1.2.3/dist/jquery.lite.js | 406 ++++++++--------- 1.2.3/src/ajax.js | 32 +- 1.2.3/src/core.js | 162 +++---- 1.2.3/src/event.js | 102 ++--- 1.2.3/src/fx.js | 52 +-- 1.2.3/src/offset.js | 36 +- 1.2.3/src/selector.js | 22 +- 1.2.3/test/data/testrunner.js | 28 +- 1.2.3/test/data/testsuite.css | 4 +- 1.2.3/test/index.html | 38 +- 1.2.3/test/offset.html | 6 +- 1.2.3/test/unit/ajax.js | 76 ++-- 1.2.3/test/unit/core.js | 160 +++---- 1.2.3/test/unit/event.js | 12 +- 1.2.3/test/unit/fx.js | 42 +- 1.2.3/test/unit/offset.js | 52 +-- 1.2.3/test/unit/selector.js | 38 +- 1.2.4/dist/jquery.js | 420 +++++++++--------- 1.2.4/dist/jquery.lite.js | 420 +++++++++--------- 1.2.4/src/ajax.js | 32 +- 1.2.4/src/core.js | 162 +++---- 1.2.4/src/event.js | 102 ++--- 1.2.4/src/fx.js | 52 +-- 1.2.4/src/offset.js | 50 +-- 1.2.4/src/selector.js | 22 +- 1.2.4/test/data/testrunner.js | 28 +- 1.2.4/test/data/testsuite.css | 4 +- 1.2.4/test/index.html | 38 +- 1.2.4/test/offset.html | 6 +- 1.2.4/test/unit/ajax.js | 76 ++-- 1.2.4/test/unit/core.js | 160 +++---- 1.2.4/test/unit/event.js | 12 +- 1.2.4/test/unit/fx.js | 42 +- 1.2.4/test/unit/offset.js | 52 +-- 1.2.4/test/unit/selector.js | 38 +- 1.2.5/dist/jquery.js | 8 +- 1.2.5/dist/jquery.lite.js | 8 +- 1.2.5/test/data/testrunner.js | 30 +- 1.2.5/test/data/testsuite.css | 4 +- 1.2.5/test/index.html | 38 +- 1.2.5/test/offset.html | 6 +- 1.2.5/test/unit/ajax.js | 78 ++-- 1.2.5/test/unit/dimensions.js | 22 +- 1.2.5/test/unit/event.js | 24 +- 1.2.5/test/unit/fx.js | 42 +- 1.2.5/test/unit/offset.js | 80 ++-- 1.2.5/test/unit/selector.js | 38 +- 1.2.6/dist/jquery.js | 8 +- 1.2.6/dist/jquery.lite.js | 8 +- 1.2.6/test/data/testrunner.js | 30 +- 1.2.6/test/data/testsuite.css | 4 +- 1.2.6/test/index.html | 38 +- 1.2.6/test/offset.html | 6 +- 1.2.6/test/unit/ajax.js | 78 ++-- 1.2.6/test/unit/dimensions.js | 22 +- 1.2.6/test/unit/event.js | 24 +- 1.2.6/test/unit/fx.js | 42 +- 1.2.6/test/unit/offset.js | 80 ++-- 1.2.6/test/unit/selector.js | 38 +- 1.3/dist/jquery.js | 134 +++--- 1.3/dist/jquery.lite.js | 134 +++--- 1.3/test/index.html | 42 +- 1.3/test/offset.html | 6 +- 1.3/test/otherlibs/mootools/1.11/mootools.js | 8 +- .../otherlibs/scriptaculous/1.7.0/builder.js | 30 +- .../otherlibs/scriptaculous/1.7.0/controls.js | 146 +++--- .../otherlibs/scriptaculous/1.7.0/dragdrop.js | 270 +++++------ .../otherlibs/scriptaculous/1.7.0/effects.js | 244 +++++----- .../scriptaculous/1.7.0/scriptaculous.js | 10 +- .../otherlibs/scriptaculous/1.7.0/slider.js | 74 +-- .../otherlibs/scriptaculous/1.7.0/unittest.js | 114 ++--- .../otherlibs/scriptaculous/1.8.1/builder.js | 28 +- .../otherlibs/scriptaculous/1.8.1/controls.js | 122 ++--- .../otherlibs/scriptaculous/1.8.1/dragdrop.js | 288 ++++++------ .../otherlibs/scriptaculous/1.8.1/effects.js | 250 +++++------ .../scriptaculous/1.8.1/scriptaculous.js | 14 +- .../otherlibs/scriptaculous/1.8.1/slider.js | 74 +-- .../otherlibs/scriptaculous/1.8.1/sound.js | 8 +- .../otherlibs/scriptaculous/1.8.1/unittest.js | 132 +++--- 1.3/test/unit/ajax.js | 96 ++-- 1.3/test/unit/core.js | 90 ++-- 1.3/test/unit/dimensions.js | 22 +- 1.3/test/unit/event.js | 90 ++-- 1.3/test/unit/fx.js | 48 +- 1.3/test/unit/offset.js | 84 ++-- 1.3/test/unit/selector.js | 52 +-- .../jquery-ui-personalized-1.6rc5.js | 100 ++--- 88 files changed, 3428 insertions(+), 3428 deletions(-) diff --git a/1.2.3/dist/jquery.js b/1.2.3/dist/jquery.js index 2e43a82..1e6adfe 100644 --- a/1.2.3/dist/jquery.js +++ b/1.2.3/dist/jquery.js @@ -22,7 +22,7 @@ var jQuery = window.jQuery = function( selector, context ) { // Map over the $ in case of overwrite if ( window.$ ) var _$ = window.$; - + // Map the jQuery namespace to the '$' one window.$ = jQuery; @@ -99,7 +99,7 @@ jQuery.fn = jQuery.prototype = { // HANDLE: $(*) [ selector ] ); }, - + // The current version of jQuery being used jquery: "1.2.3", @@ -107,7 +107,7 @@ jQuery.fn = jQuery.prototype = { size: function() { return this.length; }, - + // The number of elements contained in the matched element set length: 0, @@ -122,7 +122,7 @@ jQuery.fn = jQuery.prototype = { // Return just the object this[ num ]; }, - + // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { @@ -135,7 +135,7 @@ jQuery.fn = jQuery.prototype = { // Return the newly-formed element set return ret; }, - + // Force the current matched set of elements to become // the specified array of elements (destroying the stack in the process) // You should use pushStack() in order to do this, but maintain the stack @@ -144,7 +144,7 @@ jQuery.fn = jQuery.prototype = { // is a super-fast way to populate an object with array-like properties this.length = 0; Array.prototype.push.apply( this, elems ); - + return this; }, @@ -155,7 +155,7 @@ jQuery.fn = jQuery.prototype = { return jQuery.each( this, callback, args ); }, - // Determine the position of an element within + // Determine the position of an element within // the matched set of elements index: function( elem ) { var ret = -1; @@ -171,7 +171,7 @@ jQuery.fn = jQuery.prototype = { attr: function( name, value, type ) { var options = name; - + // Look for the case where we're accessing a style value if ( name.constructor == String ) if ( value == undefined ) @@ -181,7 +181,7 @@ jQuery.fn = jQuery.prototype = { options = {}; options[ name ] = value; } - + // Check to see if we're setting style values return this.each(function(i){ // Set all the styles @@ -264,7 +264,7 @@ jQuery.fn = jQuery.prototype = { this.insertBefore( elem, this.firstChild ); }); }, - + before: function() { return this.domManip(arguments, false, false, function(elem){ this.parentNode.insertBefore( elem, this ); @@ -299,8 +299,8 @@ jQuery.fn = jQuery.prototype = { // using cloneNode. Calling detachEvent on the // clone will also remove the events from the orignal // In order to get around this, we use innerHTML. - // Unfortunately, this means some modifications to - // attributes in IE that are actually only stored + // Unfortunately, this means some modifications to + // attributes in IE that are actually only stored // as properties will not be copied (such as the // the name attribute on an input). var clone = this.cloneNode(true), @@ -318,7 +318,7 @@ jQuery.fn = jQuery.prototype = { if ( this[ expando ] != undefined ) this[ expando ] = null; }); - + // Copy the events from the original to the clone if ( events === true ) this.find("*").andSelf().each(function(i){ @@ -360,9 +360,9 @@ jQuery.fn = jQuery.prototype = { }, add: function( selector ) { - return !selector ? this : this.pushStack( jQuery.merge( + return !selector ? this : this.pushStack( jQuery.merge( this.get(), - selector.constructor == String ? + selector.constructor == String ? jQuery( selector ).get() : selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? selector : [selector] ) ); @@ -377,7 +377,7 @@ jQuery.fn = jQuery.prototype = { hasClass: function( selector ) { return this.is( "." + selector ); }, - + val: function( value ) { if ( value == undefined ) { @@ -390,7 +390,7 @@ jQuery.fn = jQuery.prototype = { values = [], options = elem.options, one = elem.type == "select-one"; - + // Nothing was selected if ( index < 0 ) return null; @@ -402,18 +402,18 @@ jQuery.fn = jQuery.prototype = { if ( option.selected ) { // Get the specifc value for the option value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; - + // We don't need an array for one selects if ( one ) return value; - + // Multi-Selects return an array values.push( value ); } } - + return values; - + // Everything else, we just grab the value } else return (this[0].value || "").replace(/\r/g, ""); @@ -448,7 +448,7 @@ jQuery.fn = jQuery.prototype = { this.value = value; }); }, - + html: function( value ) { return value == undefined ? (this.length ? @@ -485,7 +485,7 @@ jQuery.fn = jQuery.prototype = { if ( value == null ) { var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - + if ( data == undefined && this.length ) data = jQuery.data( this[0], key ); @@ -503,9 +503,9 @@ jQuery.fn = jQuery.prototype = { jQuery.removeData( this, key ); }); }, - + domManip: function( args, table, reverse, callback ) { - var clone = this.length > 1, elems; + var clone = this.length > 1, elems; return this.each(function(){ if ( !elems ) { @@ -625,10 +625,10 @@ jQuery.extend({ // See test/unit/core.js for details concerning this function. isFunction: function( fn ) { - return !!fn && typeof fn != "string" && !fn.nodeName && + return !!fn && typeof fn != "string" && !fn.nodeName && fn.constructor != Array && /function/i.test( fn + "" ); }, - + // check if an element is in a (or is an) XML document isXMLDoc: function( elem ) { return elem.documentElement && !elem.body || @@ -659,9 +659,9 @@ jQuery.extend({ nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); }, - + cache: {}, - + data: function( elem, name, data ) { elem = elem == window ? windowData : @@ -670,24 +670,24 @@ jQuery.extend({ var id = elem[ expando ]; // Compute a unique ID for the element - if ( !id ) + if ( !id ) id = elem[ expando ] = ++uuid; // Only generate the data cache if we're // trying to access or manipulate it if ( name && !jQuery.cache[ id ] ) jQuery.cache[ id ] = {}; - + // Prevent overriding the named cache with undefined values if ( data != undefined ) jQuery.cache[ id ][ name ] = data; - - // Return the named cache data, or the ID for the element + + // Return the named cache data, or the ID for the element return name ? jQuery.cache[ id ][ name ] : id; }, - + removeData: function( elem, name ) { elem = elem == window ? windowData : @@ -747,18 +747,18 @@ jQuery.extend({ if ( callback.call( object[ name ], name, object[ name ] ) === false ) break; } else - for ( var i = 0, length = object.length, value = object[0]; + for ( var i = 0, length = object.length, value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} } return object; }, - + prop: function( elem, value, type, i, name ) { // Handle executable functions if ( jQuery.isFunction( value ) ) value = value.call( elem, i ); - + // Handle passing in a number to a CSS property return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? value + "px" : @@ -779,7 +779,7 @@ jQuery.extend({ if (elem.nodeType == 1) elem.className = classNames != undefined ? jQuery.grep(elem.className.split(/\s+/), function(className){ - return !jQuery.className.has( classNames, className ); + return !jQuery.className.has( classNames, className ); }).join(" ") : ""; }, @@ -809,7 +809,7 @@ jQuery.extend({ css: function( elem, name, force ) { if ( name == "width" || name == "height" ) { var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; - + function getWH() { val = name == "width" ? elem.offsetWidth : elem.offsetHeight; var padding = 0, border = 0; @@ -819,15 +819,15 @@ jQuery.extend({ }); val -= Math.round(padding + border); } - + if ( jQuery(elem).is(":visible") ) getWH(); else jQuery.swap( elem, props, getWH ); - + return Math.max(0, val); } - + return jQuery.curCSS( elem, name, force ); }, @@ -857,7 +857,7 @@ jQuery.extend({ elem.style.outline = "0 solid black"; elem.style.outline = save; } - + // Make sure we're using the right name for getting the float value if ( name.match( /float/i ) ) name = styleFloat; @@ -940,12 +940,12 @@ jQuery.extend({ return ret; }, - + clean: function( elems, context ) { var ret = []; context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' - if (typeof context.createElement == 'undefined') + if (typeof context.createElement == 'undefined') context = context.ownerDocument || context[0] && context[0].ownerDocument || document; jQuery.each(elems, function(i, elem){ @@ -954,7 +954,7 @@ jQuery.extend({ if ( elem.constructor == Number ) elem = elem.toString(); - + // Convert html string into DOM nodes if ( typeof elem == "string" ) { // Fix "XHTML"-style tags in all browsers @@ -971,58 +971,58 @@ jQuery.extend({ // option or optgroup !tags.indexOf("", "" ] || - + !tags.indexOf("", "" ] || - + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [ 1, "", "
" ] || - + !tags.indexOf("", "" ] || - + // matched above (!tags.indexOf("", "" ] || - + !tags.indexOf("", "" ] || // IE can't serialize and '); }, load: function() { - if((typeof Prototype=='undefined') || - (typeof Element == 'undefined') || + if((typeof Prototype=='undefined') || + (typeof Element == 'undefined') || (typeof Element.Methods=='undefined') || parseFloat(Prototype.Version.split(".")[0] + "." + Prototype.Version.split(".")[1]) < 1.5) throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0"); - + $A(document.getElementsByTagName("script")).findAll( function(s) { return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) }).each( function(s) { diff --git a/1.3/test/otherlibs/scriptaculous/1.7.0/slider.js b/1.3/test/otherlibs/scriptaculous/1.7.0/slider.js index f24f282..370de54 100644 --- a/1.3/test/otherlibs/scriptaculous/1.7.0/slider.js +++ b/1.3/test/otherlibs/scriptaculous/1.7.0/slider.js @@ -1,6 +1,6 @@ // script.aculo.us slider.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 -// Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs +// Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ @@ -17,13 +17,13 @@ Control.Slider = Class.create(); Control.Slider.prototype = { initialize: function(handle, track, options) { var slider = this; - + if(handle instanceof Array) { this.handles = handle.collect( function(e) { return $(e) }); } else { this.handles = [$(handle)]; } - + this.track = $(track); this.options = options || {}; @@ -31,7 +31,7 @@ Control.Slider.prototype = { this.increment = this.options.increment || 1; this.step = parseInt(this.options.step || '1'); this.range = this.options.range || $R(0,1); - + this.value = 0; // assure backwards compat this.values = this.handles.map( function() { return 0 }); this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; @@ -46,13 +46,13 @@ Control.Slider.prototype = { // Will be used to align the handle onto the track, if necessary this.alignX = parseInt(this.options.alignX || '0'); this.alignY = parseInt(this.options.alignY || '0'); - + this.trackLength = this.maximumOffset() - this.minimumOffset(); - this.handleLength = this.isVertical() ? - (this.handles[0].offsetHeight != 0 ? - this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : - (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : + this.handleLength = this.isVertical() ? + (this.handles[0].offsetHeight != 0 ? + this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : + (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : this.handles[0].style.width.replace(/px$/,"")); this.active = false; @@ -76,21 +76,21 @@ Control.Slider.prototype = { this.handles.each( function(h,i) { i = slider.handles.length-1-i; slider.setValue(parseFloat( - (slider.options.sliderValue instanceof Array ? - slider.options.sliderValue[i] : slider.options.sliderValue) || + (slider.options.sliderValue instanceof Array ? + slider.options.sliderValue[i] : slider.options.sliderValue) || slider.range.start), i); Element.makePositioned(h); // fix IE Event.observe(h, "mousedown", slider.eventMouseDown); }); - + Event.observe(this.track, "mousedown", this.eventMouseDown); Event.observe(document, "mouseup", this.eventMouseUp); Event.observe(document, "mousemove", this.eventMouseMove); - + this.initialized = true; }, dispose: function() { - var slider = this; + var slider = this; Event.stopObserving(this.track, "mousedown", this.eventMouseDown); Event.stopObserving(document, "mouseup", this.eventMouseUp); Event.stopObserving(document, "mousemove", this.eventMouseMove); @@ -103,12 +103,12 @@ Control.Slider.prototype = { }, setEnabled: function(){ this.disabled = false; - }, + }, getNearestValue: function(value){ if(this.allowedValues){ if(value >= this.allowedValues.max()) return(this.allowedValues.max()); if(value <= this.allowedValues.min()) return(this.allowedValues.min()); - + var offset = Math.abs(this.allowedValues[0] - value); var newValue = this.allowedValues[0]; this.allowedValues.each( function(v) { @@ -116,7 +116,7 @@ Control.Slider.prototype = { if(currentOffset <= offset){ newValue = v; offset = currentOffset; - } + } }); return newValue; } @@ -140,28 +140,28 @@ Control.Slider.prototype = { sliderValue = this.getNearestValue(sliderValue); this.values[handleIdx] = sliderValue; this.value = this.values[0]; // assure backwards compat - - this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = + + this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = this.translateToPx(sliderValue); - + this.drawSpans(); if(!this.dragging || !this.event) this.updateFinished(); }, setValueBy: function(delta, handleIdx) { - this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, + this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, handleIdx || this.activeHandleIdx || 0); }, translateToPx: function(value) { return Math.round( - ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * + ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * (value - this.range.start)) + "px"; }, translateToValue: function(offset) { - return ((offset/(this.trackLength-this.handleLength) * + return ((offset/(this.trackLength-this.handleLength) * (this.range.end-this.range.start)) + this.range.start); }, getRange: function(range) { - var v = this.values.sortBy(Prototype.K); + var v = this.values.sortBy(Prototype.K); range = range || 0; return $R(v[range],v[range+1]); }, @@ -169,12 +169,12 @@ Control.Slider.prototype = { return(this.isVertical() ? this.alignY : this.alignX); }, maximumOffset: function(){ - return(this.isVertical() ? + return(this.isVertical() ? (this.track.offsetHeight != 0 ? this.track.offsetHeight : - this.track.style.height.replace(/px$/,"")) - this.alignY : - (this.track.offsetWidth != 0 ? this.track.offsetWidth : + this.track.style.height.replace(/px$/,"")) - this.alignY : + (this.track.offsetWidth != 0 ? this.track.offsetWidth : this.track.style.width.replace(/px$/,"")) - this.alignY); - }, + }, isVertical: function(){ return (this.axis == 'vertical'); }, @@ -186,7 +186,7 @@ Control.Slider.prototype = { this.setSpan(this.options.startSpan, $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); if(this.options.endSpan) - this.setSpan(this.options.endSpan, + this.setSpan(this.options.endSpan, $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); }, setSpan: function(span, range) { @@ -206,14 +206,14 @@ Control.Slider.prototype = { if(Event.isLeftClick(event)) { if(!this.disabled){ this.active = true; - + var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; var track = handle; if(track==this.track) { - var offsets = Position.cumulativeOffset(this.track); + var offsets = Position.cumulativeOffset(this.track); this.event = event; - this.setValue(this.translateToValue( + this.setValue(this.translateToValue( (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) )); var offsets = Position.cumulativeOffset(this.activeHandle); @@ -221,14 +221,14 @@ Control.Slider.prototype = { this.offsetY = (pointer[1] - offsets[1]); } else { // find the handle (prevents issues with Safari) - while((this.handles.indexOf(handle) == -1) && handle.parentNode) + while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; - + if(this.handles.indexOf(handle)!=-1) { this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); - + var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); @@ -264,14 +264,14 @@ Control.Slider.prototype = { } this.active = false; this.dragging = false; - }, + }, finishDrag: function(event, success) { this.active = false; this.dragging = false; this.updateFinished(); }, updateFinished: function() { - if(this.initialized && this.options.onChange) + if(this.initialized && this.options.onChange) this.options.onChange(this.values.length>1 ? this.values : this.value, this); this.event = null; } diff --git a/1.3/test/otherlibs/scriptaculous/1.7.0/unittest.js b/1.3/test/otherlibs/scriptaculous/1.7.0/unittest.js index a447885..882d175 100644 --- a/1.3/test/otherlibs/scriptaculous/1.7.0/unittest.js +++ b/1.3/test/otherlibs/scriptaculous/1.7.0/unittest.js @@ -19,10 +19,10 @@ Event.simulateMouse = function(element, eventName) { metaKey: false }, arguments[2] || {}); var oEvent = document.createEvent("MouseEvents"); - oEvent.initMouseEvent(eventName, true, true, document.defaultView, - options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, + oEvent.initMouseEvent(eventName, true, true, document.defaultView, + options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element)); - + if(this.mark) Element.remove(this.mark); this.mark = document.createElement('div'); this.mark.appendChild(document.createTextNode(" ")); @@ -34,10 +34,10 @@ Event.simulateMouse = function(element, eventName) { this.mark.style.height = "5px;"; this.mark.style.borderTop = "1px solid red;" this.mark.style.borderLeft = "1px solid red;" - + if(this.step) alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options)); - + $(element).dispatchEvent(oEvent); }; @@ -55,7 +55,7 @@ Event.simulateKey = function(element, eventName) { }, arguments[2] || {}); var oEvent = document.createEvent("KeyEvents"); - oEvent.initKeyEvent(eventName, true, true, window, + oEvent.initKeyEvent(eventName, true, true, window, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.keyCode, options.charCode ); $(element).dispatchEvent(oEvent); @@ -123,7 +123,7 @@ Test.Unit.Logger.prototype = { _toHTML: function(txt) { return txt.escapeHTML().replace(/\n/g,"
"); }, - addLinksToResults: function(){ + addLinksToResults: function(){ $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log td.title = "Run only this test" Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;}); @@ -162,7 +162,7 @@ Test.Unit.Runner.prototype = { if(/^test/.test(testcase)) { this.tests.push( new Test.Unit.Testcase( - this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, + this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, testcases[testcase], testcases["setup"], testcases["teardown"] )); } @@ -203,7 +203,7 @@ Test.Unit.Runner.prototype = { }, postResults: function() { if (this.options.resultsURL) { - new Ajax.Request(this.options.resultsURL, + new Ajax.Request(this.options.resultsURL, { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false }); } }, @@ -240,9 +240,9 @@ Test.Unit.Runner.prototype = { errors += this.tests[i].errors; } return ( - (this.options.context ? this.options.context + ': ': '') + - this.tests.length + " tests, " + - assertions + " assertions, " + + (this.options.context ? this.options.context + ': ': '') + + this.tests.length + " tests, " + + assertions + " assertions, " + failures + " failures, " + errors + " errors"); } @@ -258,7 +258,7 @@ Test.Unit.Assertions.prototype = { }, summary: function() { return ( - this.assertions + " assertions, " + + this.assertions + " assertions, " + this.failures + " failures, " + this.errors + " errors" + "\n" + this.messages.join("\n")); @@ -284,55 +284,55 @@ Test.Unit.Assertions.prototype = { }, assert: function(expression) { var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"'; - try { expression ? this.pass() : + try { expression ? this.pass() : this.fail(message); } catch(e) { this.error(e); } }, assertEqual: function(expected, actual) { var message = arguments[2] || "assertEqual"; try { (expected == actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertInspect: function(expected, actual) { var message = arguments[2] || "assertInspect"; try { (expected == actual.inspect()) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertEnumEqual: function(expected, actual) { var message = arguments[2] || "assertEnumEqual"; - try { $A(expected).length == $A(actual).length && + try { $A(expected).length == $A(actual).length && expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ? - this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + + this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + ', actual ' + Test.Unit.inspect(actual)); } catch(e) { this.error(e); } }, assertNotEqual: function(expected, actual) { var message = arguments[2] || "assertNotEqual"; - try { (expected != actual) ? this.pass() : + try { (expected != actual) ? this.pass() : this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, - assertIdentical: function(expected, actual) { - var message = arguments[2] || "assertIdentical"; - try { (expected === actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } + assertIdentical: function(expected, actual) { + var message = arguments[2] || "assertIdentical"; + try { (expected === actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } }, - assertNotIdentical: function(expected, actual) { - var message = arguments[2] || "assertNotIdentical"; - try { !(expected === actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } + assertNotIdentical: function(expected, actual) { + var message = arguments[2] || "assertNotIdentical"; + try { !(expected === actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } }, assertNull: function(obj) { var message = arguments[1] || 'assertNull' - try { (obj==null) ? this.pass() : + try { (obj==null) ? this.pass() : this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); } catch(e) { this.error(e); } }, @@ -353,38 +353,38 @@ Test.Unit.Assertions.prototype = { }, assertType: function(expected, actual) { var message = arguments[2] || 'assertType'; - try { - (actual.constructor == expected) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + try { + (actual.constructor == expected) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + (actual.constructor) + '"'); } catch(e) { this.error(e); } }, assertNotOfType: function(expected, actual) { var message = arguments[2] || 'assertNotOfType'; - try { - (actual.constructor != expected) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + try { + (actual.constructor != expected) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + (actual.constructor) + '"'); } catch(e) { this.error(e); } }, assertInstanceOf: function(expected, actual) { var message = arguments[2] || 'assertInstanceOf'; - try { - (actual instanceof expected) ? this.pass() : + try { + (actual instanceof expected) ? this.pass() : this.fail(message + ": object was not an instance of the expected type"); } - catch(e) { this.error(e); } + catch(e) { this.error(e); } }, assertNotInstanceOf: function(expected, actual) { var message = arguments[2] || 'assertNotInstanceOf'; - try { - !(actual instanceof expected) ? this.pass() : + try { + !(actual instanceof expected) ? this.pass() : this.fail(message + ": object was an instance of the not expected type"); } - catch(e) { this.error(e); } + catch(e) { this.error(e); } }, assertRespondsTo: function(method, obj) { var message = arguments[2] || 'assertRespondsTo'; try { - (obj[method] && typeof obj[method] == 'function') ? this.pass() : + (obj[method] && typeof obj[method] == 'function') ? this.pass() : this.fail(message + ": object doesn't respond to [" + method + "]"); } catch(e) { this.error(e); } }, @@ -393,7 +393,7 @@ Test.Unit.Assertions.prototype = { try { var m = obj[method]; if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; - m() ? this.pass() : + m() ? this.pass() : this.fail(message + ": method returned false"); } catch(e) { this.error(e); } }, @@ -402,17 +402,17 @@ Test.Unit.Assertions.prototype = { try { var m = obj[method]; if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; - !m() ? this.pass() : + !m() ? this.pass() : this.fail(message + ": method returned true"); } catch(e) { this.error(e); } }, assertRaise: function(exceptionName, method) { var message = arguments[2] || 'assertRaise'; - try { + try { method(); this.fail(message + ": exception expected but none was raised"); } catch(e) { - ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); + ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); } }, assertElementsMatch: function() { @@ -434,7 +434,7 @@ Test.Unit.Assertions.prototype = { var startAt = new Date(); (iterations || 1).times(operation); var timeTaken = ((new Date())-startAt); - this.info((arguments[2] || 'Operation') + ' finished ' + + this.info((arguments[2] || 'Operation') + ' finished ' + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); return timeTaken; }, @@ -444,7 +444,7 @@ Test.Unit.Assertions.prototype = { this.assertNotNull(element); if(element.style && Element.getStyle(element, 'display') == 'none') return false; - + return this._isVisible(element.parentNode); }, assertNotVisible: function(element) { @@ -457,7 +457,7 @@ Test.Unit.Assertions.prototype = { var startAt = new Date(); (iterations || 1).times(operation); var timeTaken = ((new Date())-startAt); - this.info((arguments[2] || 'Operation') + ' finished ' + + this.info((arguments[2] || 'Operation') + ' finished ' + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); return timeTaken; } @@ -468,7 +468,7 @@ Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.p initialize: function(name, test, setup, teardown) { Test.Unit.Assertions.prototype.initialize.bind(this)(); this.name = name; - + if(typeof test == 'string') { test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,'); test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)'); @@ -478,7 +478,7 @@ Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.p } else { this.test = test || function() {}; } - + this.setup = setup || function() {}; this.teardown = teardown || function() {}; this.isWaiting = false; @@ -519,7 +519,7 @@ Test.setupBDDExtensionMethods = function(){ shouldNotBeAn: 'assertNotOfType', shouldBeNull: 'assertNull', shouldNotBeNull: 'assertNotNull', - + shouldBe: 'assertReturnsTrue', shouldNotBe: 'assertReturnsFalse', shouldRespondTo: 'assertRespondsTo' @@ -539,7 +539,7 @@ Test.setupBDDExtensionMethods = function(){ Test.context = function(name, spec, log){ Test.setupBDDExtensionMethods(); - + var compiledSpec = {}; var titles = {}; for(specName in spec) { @@ -553,7 +553,7 @@ Test.context = function(name, spec, log){ var body = spec[specName].toString().split('\n').slice(1); if(/^\{/.test(body[0])) body = body.slice(1); body.pop(); - body = body.map(function(statement){ + body = body.map(function(statement){ return statement.strip() }); compiledSpec[testName] = body.join('\n'); diff --git a/1.3/test/otherlibs/scriptaculous/1.8.1/builder.js b/1.3/test/otherlibs/scriptaculous/1.8.1/builder.js index 8301999..524d3a5 100644 --- a/1.3/test/otherlibs/scriptaculous/1.8.1/builder.js +++ b/1.3/test/otherlibs/scriptaculous/1.8.1/builder.js @@ -26,7 +26,7 @@ var Builder = { // due to a Firefox bug node: function(elementName) { elementName = elementName.toUpperCase(); - + // try innerHTML approach var parentTag = this.NODEMAP[elementName] || 'div'; var parentElement = document.createElement(parentTag); @@ -34,14 +34,14 @@ var Builder = { parentElement.innerHTML = "<" + elementName + ">"; } catch(e) {} var element = parentElement.firstChild || null; - + // see if browser added wrapping tags if(element && (element.tagName.toUpperCase() != elementName)) element = element.getElementsByTagName(elementName)[0]; - + // fallback to createElement approach if(!element) element = document.createElement(elementName); - + // abort if nothing could be created if(!element) return; @@ -62,13 +62,13 @@ var Builder = { // workaround firefox 1.0.X bug if(!element) { element = document.createElement(elementName); - for(attr in arguments[1]) + for(attr in arguments[1]) element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; } if(element.tagName.toUpperCase() != elementName) element = parentElement.getElementsByTagName(elementName)[0]; } - } + } // text, or array of children if(arguments[2]) @@ -117,20 +117,20 @@ var Builder = { $(element).update(html.strip()); return element.down(); }, - dump: function(scope) { - if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope - + dump: function(scope) { + if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope + var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); - - tags.each( function(tag){ - scope[tag] = function() { - return Builder.node.apply(Builder, [tag].concat($A(arguments))); - } + + tags.each( function(tag){ + scope[tag] = function() { + return Builder.node.apply(Builder, [tag].concat($A(arguments))); + } }); } } diff --git a/1.3/test/otherlibs/scriptaculous/1.8.1/controls.js b/1.3/test/otherlibs/scriptaculous/1.8.1/controls.js index 5012cb8..12fbca1 100644 --- a/1.3/test/otherlibs/scriptaculous/1.8.1/controls.js +++ b/1.3/test/otherlibs/scriptaculous/1.8.1/controls.js @@ -7,18 +7,18 @@ // Richard Livsey // Rahul Bhargava // Rob Wills -// +// // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ -// Autocompleter.Base handles all the autocompletion functionality +// Autocompleter.Base handles all the autocompletion functionality // that's independent of the data source for autocompletion. This // includes drawing the autocompletion menu, observing keyboard // and mouse events, and similar. // -// Specific autocompleters need to provide, at the very least, +// Specific autocompleters need to provide, at the very least, // a getUpdatedChoices function that will be invoked every time -// the text inside the monitored textbox changes. This method +// the text inside the monitored textbox changes. This method // should get the text for which to provide autocompletion by // invoking this.getToken(), NOT by directly accessing // this.element.value. This is to allow incremental tokenized @@ -32,8 +32,8 @@ // will incrementally autocomplete with a comma as the token. // Additionally, ',' in the above example can be replaced with // a token array, e.g. { tokens: [',', '\n'] } which -// enables autocompletion on multiple tokens. This is most -// useful when one of the tokens is \n (a newline), as it +// enables autocompletion on multiple tokens. This is most +// useful when one of the tokens is \n (a newline), as it // allows smart autocompletion after linebreaks. if(typeof Effect == 'undefined') @@ -43,12 +43,12 @@ var Autocompleter = { } Autocompleter.Base = Class.create({ baseInitialize: function(element, update, options) { element = $(element) - this.element = element; - this.update = $(update); - this.hasFocus = false; - this.changed = false; - this.active = false; - this.index = 0; + this.element = element; + this.update = $(update); + this.hasFocus = false; + this.changed = false; + this.active = false; + this.index = 0; this.entryCount = 0; this.oldElementValue = this.element.value; @@ -61,28 +61,28 @@ Autocompleter.Base = Class.create({ this.options.tokens = this.options.tokens || []; this.options.frequency = this.options.frequency || 0.4; this.options.minChars = this.options.minChars || 1; - this.options.onShow = this.options.onShow || - function(element, update){ + this.options.onShow = this.options.onShow || + function(element, update){ if(!update.style.position || update.style.position=='absolute') { update.style.position = 'absolute'; Position.clone(element, update, { - setHeight: false, + setHeight: false, offsetTop: element.offsetHeight }); } Effect.Appear(update,{duration:0.15}); }; - this.options.onHide = this.options.onHide || + this.options.onHide = this.options.onHide || function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - if(typeof(this.options.tokens) == 'string') + if(typeof(this.options.tokens) == 'string') this.options.tokens = new Array(this.options.tokens); // Force carriage returns as token delimiters anyway if (!this.options.tokens.include('\n')) this.options.tokens.push('\n'); this.observer = null; - + this.element.setAttribute('autocomplete','off'); Element.hide(this.update); @@ -93,10 +93,10 @@ Autocompleter.Base = Class.create({ show: function() { if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && + if(!this.iefix && (Prototype.Browser.IE) && (Element.getStyle(this.update, 'position')=='absolute')) { - new Insertion.After(this.update, + new Insertion.After(this.update, ''); @@ -104,7 +104,7 @@ Autocompleter.Base = Class.create({ } if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); }, - + fixIEOverlapping: function() { Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); this.iefix.style.zIndex = 1; @@ -152,15 +152,15 @@ Autocompleter.Base = Class.create({ Event.stop(event); return; } - else - if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || + else + if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; this.changed = true; this.hasFocus = true; if(this.observer) clearTimeout(this.observer); - this.observer = + this.observer = setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); }, @@ -172,35 +172,35 @@ Autocompleter.Base = Class.create({ onHover: function(event) { var element = Event.findElement(event, 'LI'); - if(this.index != element.autocompleteIndex) + if(this.index != element.autocompleteIndex) { this.index = element.autocompleteIndex; this.render(); } Event.stop(event); }, - + onClick: function(event) { var element = Event.findElement(event, 'LI'); this.index = element.autocompleteIndex; this.selectEntry(); this.hide(); }, - + onBlur: function(event) { // needed to make click events working setTimeout(this.hide.bind(this), 250); this.hasFocus = false; - this.active = false; - }, - + this.active = false; + }, + render: function() { if(this.entryCount > 0) { for (var i = 0; i < this.entryCount; i++) - this.index==i ? - Element.addClassName(this.getEntry(i),"selected") : + this.index==i ? + Element.addClassName(this.getEntry(i),"selected") : Element.removeClassName(this.getEntry(i),"selected"); - if(this.hasFocus) { + if(this.hasFocus) { this.show(); this.active = true; } @@ -209,27 +209,27 @@ Autocompleter.Base = Class.create({ this.hide(); } }, - + markPrevious: function() { if(this.index > 0) this.index-- else this.index = this.entryCount-1; this.getEntry(this.index).scrollIntoView(true); }, - + markNext: function() { if(this.index < this.entryCount-1) this.index++ else this.index = 0; this.getEntry(this.index).scrollIntoView(false); }, - + getEntry: function(index) { return this.update.firstChild.childNodes[index]; }, - + getCurrentEntry: function() { return this.getEntry(this.index); }, - + selectEntry: function() { this.active = false; this.updateElement(this.getCurrentEntry()); @@ -246,7 +246,7 @@ Autocompleter.Base = Class.create({ if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); } else value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); - + var bounds = this.getTokenBounds(); if (bounds[0] != -1) { var newValue = this.element.value.substr(0, bounds[0]); @@ -259,7 +259,7 @@ Autocompleter.Base = Class.create({ } this.oldElementValue = this.element.value; this.element.focus(); - + if (this.options.afterUpdateElement) this.options.afterUpdateElement(this.element, selectedElement); }, @@ -271,20 +271,20 @@ Autocompleter.Base = Class.create({ Element.cleanWhitespace(this.update.down()); if(this.update.firstChild && this.update.down().childNodes) { - this.entryCount = + this.entryCount = this.update.down().childNodes.length; for (var i = 0; i < this.entryCount; i++) { var entry = this.getEntry(i); entry.autocompleteIndex = i; this.addObservers(entry); } - } else { + } else { this.entryCount = 0; } this.stopIndicator(); this.index = 0; - + if(this.entryCount==1 && this.options.autoSelect) { this.selectEntry(); this.hide(); @@ -300,7 +300,7 @@ Autocompleter.Base = Class.create({ }, onObserverEvent: function() { - this.changed = false; + this.changed = false; this.tokenBounds = null; if(this.getToken().length>=this.options.minChars) { this.getUpdatedChoices(); @@ -353,16 +353,16 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, { getUpdatedChoices: function() { this.startIndicator(); - - var entry = encodeURIComponent(this.options.paramName) + '=' + + + var entry = encodeURIComponent(this.options.paramName) + '=' + encodeURIComponent(this.getToken()); this.options.parameters = this.options.callback ? this.options.callback(this.element, entry) : entry; - if(this.options.defaultParams) + if(this.options.defaultParams) this.options.parameters += '&' + this.options.defaultParams; - + new Ajax.Request(this.url, this.options); }, @@ -384,7 +384,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, { // - choices - How many autocompletion choices to offer // // - partialSearch - If false, the autocompleter will match entered -// text only at the beginning of strings in the +// text only at the beginning of strings in the // autocomplete array. Defaults to true, which will // match text at the beginning of any *word* in the // strings in the autocomplete array. If you want to @@ -401,7 +401,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, { // - ignoreCase - Whether to ignore case when autocompleting. // Defaults to true. // -// It's possible to pass in a custom function as the 'selector' +// It's possible to pass in a custom function as the 'selector' // option, if you prefer to write your own autocompletion logic. // In that case, the other options above will not apply unless // you support them. @@ -429,20 +429,20 @@ Autocompleter.Local = Class.create(Autocompleter.Base, { var entry = instance.getToken(); var count = 0; - for (var i = 0; i < instance.options.array.length && - ret.length < instance.options.choices ; i++) { + for (var i = 0; i < instance.options.array.length && + ret.length < instance.options.choices ; i++) { var elem = instance.options.array[i]; - var foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase()) : + var foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase()) : elem.indexOf(entry); while (foundPos != -1) { - if (foundPos == 0 && elem.length != entry.length) { - ret.push("
  • " + elem.substr(0, entry.length) + "" + + if (foundPos == 0 && elem.length != entry.length) { + ret.push("
  • " + elem.substr(0, entry.length) + "" + elem.substr(entry.length) + "
  • "); break; - } else if (entry.length >= instance.options.partialChars && + } else if (entry.length >= instance.options.partialChars && instance.options.partialSearch && foundPos != -1) { if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { partial.push("
  • " + elem.substr(0, foundPos) + "" + @@ -452,8 +452,8 @@ Autocompleter.Local = Class.create(Autocompleter.Base, { } } - foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : + foundPos = instance.options.ignoreCase ? + elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : elem.indexOf(entry, foundPos + 1); } @@ -939,7 +939,7 @@ Ajax.InPlaceCollectionEditor.DefaultOptions = { loadingCollectionText: 'Loading options...' }; -// Delayed observer, like Form.Element.Observer, +// Delayed observer, like Form.Element.Observer, // but waits for delay after last key input // Ideal for live-search fields @@ -949,7 +949,7 @@ Form.Element.DelayedObserver = Class.create({ this.element = $(element); this.callback = callback; this.timer = null; - this.lastValue = $F(this.element); + this.lastValue = $F(this.element); Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); }, delayedListener: function(event) { diff --git a/1.3/test/otherlibs/scriptaculous/1.8.1/dragdrop.js b/1.3/test/otherlibs/scriptaculous/1.8.1/dragdrop.js index bf429c2..4281ea3 100644 --- a/1.3/test/otherlibs/scriptaculous/1.8.1/dragdrop.js +++ b/1.3/test/otherlibs/scriptaculous/1.8.1/dragdrop.js @@ -2,7 +2,7 @@ // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) -// +// // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ @@ -34,7 +34,7 @@ var Droppables = { options._containers.push($(containment)); } } - + if(options.accept) options.accept = [options.accept].flatten(); Element.makePositioned(element); // fix IE @@ -42,34 +42,34 @@ var Droppables = { this.drops.push(options); }, - + findDeepestChild: function(drops) { deepest = drops[0]; - + for (i = 1; i < drops.length; ++i) if (Element.isParent(drops[i].element, deepest.element)) deepest = drops[i]; - + return deepest; }, isContained: function(element, drop) { var containmentNode; if(drop.tree) { - containmentNode = element.treeNode; + containmentNode = element.treeNode; } else { containmentNode = element.parentNode; } return drop._containers.detect(function(c) { return containmentNode == c }); }, - + isAffected: function(point, element, drop) { return ( (drop.element!=element) && ((!drop._containers) || this.isContained(element, drop)) && ((!drop.accept) || - (Element.classNames(element).detect( + (Element.classNames(element).detect( function(v) { return drop.accept.include(v) } ) )) && Position.within(drop.element, point[0], point[1]) ); }, @@ -89,12 +89,12 @@ var Droppables = { show: function(point, element) { if(!this.drops.length) return; var drop, affected = []; - + this.drops.each( function(drop) { if(Droppables.isAffected(point, element, drop)) affected.push(drop); }); - + if(affected.length>0) drop = Droppables.findDeepestChild(affected); @@ -103,7 +103,7 @@ var Droppables = { Position.within(drop.element, point[0], point[1]); if(drop.onHover) drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); - + if (drop != this.last_active) Droppables.activate(drop); } }, @@ -114,8 +114,8 @@ var Droppables = { if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) if (this.last_active.onDrop) { - this.last_active.onDrop(element, this.last_active.element, event); - return true; + this.last_active.onDrop(element, this.last_active.element, event); + return true; } }, @@ -128,20 +128,20 @@ var Droppables = { var Draggables = { drags: [], observers: [], - + register: function(draggable) { if(this.drags.length == 0) { this.eventMouseUp = this.endDrag.bindAsEventListener(this); this.eventMouseMove = this.updateDrag.bindAsEventListener(this); this.eventKeypress = this.keyPress.bindAsEventListener(this); - + Event.observe(document, "mouseup", this.eventMouseUp); Event.observe(document, "mousemove", this.eventMouseMove); Event.observe(document, "keypress", this.eventKeypress); } this.drags.push(draggable); }, - + unregister: function(draggable) { this.drags = this.drags.reject(function(d) { return d==draggable }); if(this.drags.length == 0) { @@ -150,24 +150,24 @@ var Draggables = { Event.stopObserving(document, "keypress", this.eventKeypress); } }, - + activate: function(draggable) { - if(draggable.options.delay) { - this._timeout = setTimeout(function() { - Draggables._timeout = null; - window.focus(); - Draggables.activeDraggable = draggable; - }.bind(this), draggable.options.delay); + if(draggable.options.delay) { + this._timeout = setTimeout(function() { + Draggables._timeout = null; + window.focus(); + Draggables.activeDraggable = draggable; + }.bind(this), draggable.options.delay); } else { window.focus(); // allows keypress events if window isn't currently focused, fails for Safari this.activeDraggable = draggable; } }, - + deactivate: function() { this.activeDraggable = null; }, - + updateDrag: function(event) { if(!this.activeDraggable) return; var pointer = [Event.pointerX(event), Event.pointerY(event)]; @@ -175,36 +175,36 @@ var Draggables = { // the same coordinates, prevent needless redrawing (moz bug?) if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; this._lastPointer = pointer; - + this.activeDraggable.updateDrag(event, pointer); }, - + endDrag: function(event) { - if(this._timeout) { - clearTimeout(this._timeout); - this._timeout = null; + if(this._timeout) { + clearTimeout(this._timeout); + this._timeout = null; } if(!this.activeDraggable) return; this._lastPointer = null; this.activeDraggable.endDrag(event); this.activeDraggable = null; }, - + keyPress: function(event) { if(this.activeDraggable) this.activeDraggable.keyPress(event); }, - + addObserver: function(observer) { this.observers.push(observer); this._cacheObserverCallbacks(); }, - + removeObserver: function(element) { // element instead of observer fixes mem leaks this.observers = this.observers.reject( function(o) { return o.element==element }); this._cacheObserverCallbacks(); }, - + notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' if(this[eventName+'Count'] > 0) this.observers.each( function(o) { @@ -212,7 +212,7 @@ var Draggables = { }); if(draggable.options[eventName]) draggable.options[eventName](draggable, event); }, - + _cacheObserverCallbacks: function() { ['onStart','onEnd','onDrag'].each( function(eventName) { Draggables[eventName+'Count'] = Draggables.observers.select( @@ -236,12 +236,12 @@ var Draggable = Class.create({ }, endeffect: function(element) { var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; - new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, + new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, queue: {scope:'_draggable', position:'end'}, - afterFinish: function(){ - Draggable._dragging[element] = false + afterFinish: function(){ + Draggable._dragging[element] = false } - }); + }); }, zindex: 1000, revert: false, @@ -252,57 +252,57 @@ var Draggable = Class.create({ snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } delay: 0 }; - + if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) Object.extend(defaults, { starteffect: function(element) { element._opacity = Element.getOpacity(element); Draggable._dragging[element] = true; - new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); + new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); } }); - + var options = Object.extend(defaults, arguments[1] || { }); this.element = $(element); - + if(options.handle && Object.isString(options.handle)) this.handle = this.element.down('.'+options.handle, 0); - + if(!this.handle) this.handle = $(options.handle); if(!this.handle) this.handle = this.element; - + if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { options.scroll = $(options.scroll); this._isScrollChild = Element.childOf(this.element, options.scroll); } - Element.makePositioned(this.element); // fix IE + Element.makePositioned(this.element); // fix IE this.options = options; - this.dragging = false; + this.dragging = false; this.eventMouseDown = this.initDrag.bindAsEventListener(this); Event.observe(this.handle, "mousedown", this.eventMouseDown); - + Draggables.register(this); }, - + destroy: function() { Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); Draggables.unregister(this); }, - + currentDelta: function() { return([ parseInt(Element.getStyle(this.element,'left') || '0'), parseInt(Element.getStyle(this.element,'top') || '0')]); }, - + initDrag: function(event) { if(!Object.isUndefined(Draggable._dragging[this.element]) && Draggable._dragging[this.element]) return; - if(Event.isLeftClick(event)) { + if(Event.isLeftClick(event)) { // abort on form elements, fixes a Firefox issue var src = Event.element(event); if((tag_name = src.tagName.toUpperCase()) && ( @@ -311,26 +311,26 @@ var Draggable = Class.create({ tag_name=='OPTION' || tag_name=='BUTTON' || tag_name=='TEXTAREA')) return; - + var pointer = [Event.pointerX(event), Event.pointerY(event)]; var pos = Position.cumulativeOffset(this.element); this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); - + Draggables.activate(this); Event.stop(event); } }, - + startDrag: function(event) { this.dragging = true; if(!this.delta) this.delta = this.currentDelta(); - + if(this.options.zindex) { this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); this.element.style.zIndex = this.options.zindex; } - + if(this.options.ghosting) { this._clone = this.element.cloneNode(true); this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); @@ -338,7 +338,7 @@ var Draggable = Class.create({ Position.absolutize(this.element); this.element.parentNode.insertBefore(this._clone, this.element); } - + if(this.options.scroll) { if (this.options.scroll == window) { var where = this._getWindowScroll(this.options.scroll); @@ -349,28 +349,28 @@ var Draggable = Class.create({ this.originalScrollTop = this.options.scroll.scrollTop; } } - + Draggables.notify('onStart', this, event); - + if(this.options.starteffect) this.options.starteffect(this.element); }, - + updateDrag: function(event, pointer) { if(!this.dragging) this.startDrag(event); - + if(!this.options.quiet){ Position.prepare(); Droppables.show(pointer, this.element); } - + Draggables.notify('onDrag', this, event); - + this.draw(pointer); if(this.options.change) this.options.change(this); - + if(this.options.scroll) { this.stopScrolling(); - + var p; if (this.options.scroll == window) { with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } @@ -388,16 +388,16 @@ var Draggable = Class.create({ if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); this.startScrolling(speed); } - + // fix AppleWebKit rendering if(Prototype.Browser.WebKit) window.scrollBy(0,0); - + Event.stop(event); }, - + finishDrag: function(event, success) { this.dragging = false; - + if(this.options.quiet){ Position.prepare(); var pointer = [Event.pointerX(event), Event.pointerY(event)]; @@ -412,17 +412,17 @@ var Draggable = Class.create({ this._clone = null; } - var dropped = false; - if(success) { - dropped = Droppables.fire(event, this.element); - if (!dropped) dropped = false; + var dropped = false; + if(success) { + dropped = Droppables.fire(event, this.element); + if (!dropped) dropped = false; } if(dropped && this.options.onDropped) this.options.onDropped(this.element); Draggables.notify('onEnd', this, event); var revert = this.options.revert; if(revert && Object.isFunction(revert)) revert = revert(this.element); - + var d = this.currentDelta(); if(revert && this.options.reverteffect) { if (dropped == 0 || revert != 'failure') @@ -435,45 +435,45 @@ var Draggable = Class.create({ if(this.options.zindex) this.element.style.zIndex = this.originalZ; - if(this.options.endeffect) + if(this.options.endeffect) this.options.endeffect(this.element); - + Draggables.deactivate(this); Droppables.reset(); }, - + keyPress: function(event) { if(event.keyCode!=Event.KEY_ESC) return; this.finishDrag(event, false); Event.stop(event); }, - + endDrag: function(event) { if(!this.dragging) return; this.stopScrolling(); this.finishDrag(event, true); Event.stop(event); }, - + draw: function(point) { var pos = Position.cumulativeOffset(this.element); if(this.options.ghosting) { var r = Position.realOffset(this.element); pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; } - + var d = this.currentDelta(); pos[0] -= d[0]; pos[1] -= d[1]; - + if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; } - - var p = [0,1].map(function(i){ - return (point[i]-pos[i]-this.offset[i]) + + var p = [0,1].map(function(i){ + return (point[i]-pos[i]-this.offset[i]) }.bind(this)); - + if(this.options.snap) { if(Object.isFunction(this.options.snap)) { p = this.options.snap(p[0],p[1],this); @@ -486,16 +486,16 @@ var Draggable = Class.create({ return (v/this.options.snap).round()*this.options.snap }.bind(this)) } }} - + var style = this.element.style; if((!this.options.constraint) || (this.options.constraint=='horizontal')) style.left = p[0] + "px"; if((!this.options.constraint) || (this.options.constraint=='vertical')) style.top = p[1] + "px"; - + if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering }, - + stopScrolling: function() { if(this.scrollInterval) { clearInterval(this.scrollInterval); @@ -503,14 +503,14 @@ var Draggable = Class.create({ Draggables._lastScrollPointer = null; } }, - + startScrolling: function(speed) { if(!(speed[0] || speed[1])) return; this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; this.lastScrolled = new Date(); this.scrollInterval = setInterval(this.scroll.bind(this), 10); }, - + scroll: function() { var current = new Date(); var delta = current - this.lastScrolled; @@ -526,7 +526,7 @@ var Draggable = Class.create({ this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; } - + Position.prepare(); Droppables.show(Draggables._lastPointer, this.element); Draggables.notify('onDrag', this); @@ -540,10 +540,10 @@ var Draggable = Class.create({ Draggables._lastScrollPointer[1] = 0; this.draw(Draggables._lastScrollPointer); } - + if(this.options.change) this.options.change(this); }, - + _getWindowScroll: function(w) { var T, L, W, H; with (w.document) { @@ -579,11 +579,11 @@ var SortableObserver = Class.create({ this.observer = observer; this.lastValue = Sortable.serialize(this.element); }, - + onStart: function() { this.lastValue = Sortable.serialize(this.element); }, - + onEnd: function() { Sortable.unmark(); if(this.lastValue != Sortable.serialize(this.element)) @@ -593,11 +593,11 @@ var SortableObserver = Class.create({ var Sortable = { SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, - + sortables: { }, - + _findRootElement: function(element) { - while (element.tagName.toUpperCase() != "BODY") { + while (element.tagName.toUpperCase() != "BODY") { if(element.id && Sortable.sortables[element.id]) return element; element = element.parentNode; } @@ -608,22 +608,22 @@ var Sortable = { if(!element) return; return Sortable.sortables[element.id]; }, - + destroy: function(element){ var s = Sortable.options(element); - + if(s) { Draggables.removeObserver(s.element); s.droppables.each(function(d){ Droppables.remove(d) }); s.draggables.invoke('destroy'); - + delete Sortable.sortables[s.element.id]; } }, create: function(element) { element = $(element); - var options = Object.extend({ + var options = Object.extend({ element: element, tag: 'li', // assumes li children, override with tag: 'tagname' dropOnEmpty: false, @@ -637,17 +637,17 @@ var Sortable = { delay: 0, hoverclass: null, ghosting: false, - quiet: false, + quiet: false, scroll: false, scrollSensitivity: 20, scrollSpeed: 15, format: this.SERIALIZE_RULE, - - // these take arrays of elements or ids and can be + + // these take arrays of elements or ids and can be // used for better initialization performance elements: false, handles: false, - + onChange: Prototype.emptyFunction, onUpdate: Prototype.emptyFunction }, arguments[1] || { }); @@ -684,7 +684,7 @@ var Sortable = { if(options.zindex) options_for_draggable.zindex = options.zindex; - // build options for the droppables + // build options for the droppables var options_for_droppable = { overlap: options.overlap, containment: options.containment, @@ -692,7 +692,7 @@ var Sortable = { hoverclass: options.hoverclass, onHover: Sortable.onHover } - + var options_for_tree = { onHover: Sortable.onEmptyHover, overlap: options.overlap, @@ -701,7 +701,7 @@ var Sortable = { } // fix for gecko engine - Element.cleanWhitespace(element); + Element.cleanWhitespace(element); options.draggables = []; options.droppables = []; @@ -714,14 +714,14 @@ var Sortable = { (options.elements || this.findElements(element, options) || []).each( function(e,i) { var handle = options.handles ? $(options.handles[i]) : - (options.handle ? $(e).select('.' + options.handle)[0] : e); + (options.handle ? $(e).select('.' + options.handle)[0] : e); options.draggables.push( new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); Droppables.add(e, options_for_droppable); if(options.tree) e.treeNode = element; - options.droppables.push(e); + options.droppables.push(e); }); - + if(options.tree) { (Sortable.findTreeElements(element, options) || []).each( function(e) { Droppables.add(e, options_for_tree); @@ -743,7 +743,7 @@ var Sortable = { return Element.findChildren( element, options.only, options.tree ? true : false, options.tag); }, - + findTreeElements: function(element, options) { return Element.findChildren( element, options.only, options.tree ? true : false, options.treeTag); @@ -760,7 +760,7 @@ var Sortable = { var oldParentNode = element.parentNode; element.style.visibility = "hidden"; // fix gecko rendering dropon.parentNode.insertBefore(element, dropon); - if(dropon.parentNode!=oldParentNode) + if(dropon.parentNode!=oldParentNode) Sortable.options(oldParentNode).onChange(element); Sortable.options(dropon.parentNode).onChange(element); } @@ -771,26 +771,26 @@ var Sortable = { var oldParentNode = element.parentNode; element.style.visibility = "hidden"; // fix gecko rendering dropon.parentNode.insertBefore(element, nextElement); - if(dropon.parentNode!=oldParentNode) + if(dropon.parentNode!=oldParentNode) Sortable.options(oldParentNode).onChange(element); Sortable.options(dropon.parentNode).onChange(element); } } }, - + onEmptyHover: function(element, dropon, overlap) { var oldParentNode = element.parentNode; var droponOptions = Sortable.options(dropon); - + if(!Element.isParent(dropon, element)) { var index; - + var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); var child = null; - + if(children) { var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); - + for (index = 0; index < children.length; index += 1) { if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { offset -= Element.offsetSize (children[index], droponOptions.overlap); @@ -803,9 +803,9 @@ var Sortable = { } } } - + dropon.insertBefore(element, child); - + Sortable.options(oldParentNode).onChange(element); droponOptions.onChange(element); } @@ -818,34 +818,34 @@ var Sortable = { mark: function(dropon, position) { // mark on ghosting only var sortable = Sortable.options(dropon.parentNode); - if(sortable && !sortable.ghosting) return; + if(sortable && !sortable.ghosting) return; if(!Sortable._marker) { - Sortable._marker = + Sortable._marker = ($('dropmarker') || Element.extend(document.createElement('DIV'))). hide().addClassName('dropmarker').setStyle({position:'absolute'}); document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); - } + } var offsets = Position.cumulativeOffset(dropon); Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); - + if(position=='after') - if(sortable.overlap == 'horizontal') + if(sortable.overlap == 'horizontal') Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); else Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); - + Sortable._marker.show(); }, - + _tree: function(element, options, parent) { var children = Sortable.findElements(element, options) || []; - + for (var i = 0; i < children.length; ++i) { var match = children[i].id.match(options.format); if (!match) continue; - + var child = { id: encodeURIComponent(match ? match[1] : null), element: element, @@ -854,15 +854,15 @@ var Sortable = { position: parent.children.length, container: $(children[i]).down(options.treeTag) } - + /* Get the element containing the children and recurse over it */ if (child.container) this._tree(child.container, options, child) - + parent.children.push (child); } - return parent; + return parent; }, tree: function(element) { @@ -875,7 +875,7 @@ var Sortable = { name: element.id, format: sortableOptions.format }, arguments[1] || { }); - + var root = { id: null, parent: null, @@ -883,7 +883,7 @@ var Sortable = { container: element, position: 0 } - + return Sortable._tree(element, options, root); }, @@ -899,7 +899,7 @@ var Sortable = { sequence: function(element) { element = $(element); var options = Object.extend(this.options(element), arguments[1] || { }); - + return $(this.findElements(element, options) || []).map( function(item) { return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; }); @@ -908,14 +908,14 @@ var Sortable = { setSequence: function(element, new_sequence) { element = $(element); var options = Object.extend(this.options(element), arguments[2] || { }); - + var nodeMap = { }; this.findElements(element, options).each( function(n) { if (n.id.match(options.format)) nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; n.parentNode.removeChild(n); }); - + new_sequence.each(function(ident) { var n = nodeMap[ident]; if (n) { @@ -924,16 +924,16 @@ var Sortable = { } }); }, - + serialize: function(element) { element = $(element); var options = Object.extend(Sortable.options(element), arguments[1] || { }); var name = encodeURIComponent( (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); - + if (options.tree) { return Sortable.tree(element, arguments[1]).children.map( function (item) { - return [name + Sortable._constructIndex(item) + "[id]=" + + return [name + Sortable._constructIndex(item) + "[id]=" + encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); }).flatten().join('&'); } else { @@ -951,7 +951,7 @@ Element.isParent = function(child, element) { return Element.isParent(child.parentNode, element); } -Element.findChildren = function(element, only, recursive, tagName) { +Element.findChildren = function(element, only, recursive, tagName) { if(!element.hasChildNodes()) return null; tagName = tagName.toUpperCase(); if(only) only = [only].flatten(); diff --git a/1.3/test/otherlibs/scriptaculous/1.8.1/effects.js b/1.3/test/otherlibs/scriptaculous/1.8.1/effects.js index b8c0259..efa128f 100644 --- a/1.3/test/otherlibs/scriptaculous/1.8.1/effects.js +++ b/1.3/test/otherlibs/scriptaculous/1.8.1/effects.js @@ -5,46 +5,46 @@ // Justin Palmer (http://encytemedia.com/) // Mark Pilgrim (http://diveintomark.org/) // Martin Bialasinki -// +// // script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ +// For details, see the script.aculo.us web site: http://script.aculo.us/ -// converts rgb() and #xxx to #xxxxxx format, -// returns self (or first argument) if not convertable -String.prototype.parseColor = function() { +// converts rgb() and #xxx to #xxxxxx format, +// returns self (or first argument) if not convertable +String.prototype.parseColor = function() { var color = '#'; - if (this.slice(0,4) == 'rgb(') { - var cols = this.slice(4,this.length-1).split(','); - var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); - } else { - if (this.slice(0,1) == '#') { - if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); - if (this.length==7) color = this.toLowerCase(); - } - } - return (color.length==7 ? color : (arguments[0] || this)); + if (this.slice(0,4) == 'rgb(') { + var cols = this.slice(4,this.length-1).split(','); + var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); + } else { + if (this.slice(0,1) == '#') { + if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); + if (this.length==7) color = this.toLowerCase(); + } + } + return (color.length==7 ? color : (arguments[0] || this)); }; /*--------------------------------------------------------------------------*/ -Element.collectTextNodes = function(element) { +Element.collectTextNodes = function(element) { return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : + return (node.nodeType==3 ? node.nodeValue : (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); }).flatten().join(''); }; -Element.collectTextNodesIgnoreClass = function(element, className) { +Element.collectTextNodesIgnoreClass = function(element, className) { return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? + return (node.nodeType==3 ? node.nodeValue : + ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? Element.collectTextNodesIgnoreClass(node, className) : '')); }).flatten().join(''); }; Element.setContentZoom = function(element, percent) { - element = $(element); - element.setStyle({fontSize: (percent/100) + 'em'}); + element = $(element); + element.setStyle({fontSize: (percent/100) + 'em'}); if (Prototype.Browser.WebKit) window.scrollBy(0,0); return element; }; @@ -84,16 +84,16 @@ var Effect = { wobble: function(pos) { return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; }, - pulse: function(pos, pulses) { - pulses = pulses || 5; + pulse: function(pos, pulses) { + pulses = pulses || 5; return ( - ((pos % (1/pulses)) * pulses).round() == 0 ? - ((pos * pulses * 2) - (pos * pulses * 2).floor()) : + ((pos % (1/pulses)) * pulses).round() == 0 ? + ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor()) ); }, - spring: function(pos) { - return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); + spring: function(pos) { + return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); }, none: function(pos) { return 0; @@ -114,14 +114,14 @@ var Effect = { tagifyText: function(element) { var tagifyStyle = 'position:relative'; if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; - + element = $(element); $A(element.childNodes).each( function(child) { if (child.nodeType==3) { child.nodeValue.toArray().each( function(character) { element.insertBefore( new Element('span', {style: tagifyStyle}).update( - character == ' ' ? String.fromCharCode(160) : character), + character == ' ' ? String.fromCharCode(160) : character), child); }); Element.remove(child); @@ -130,13 +130,13 @@ var Effect = { }, multiple: function(element, effect) { var elements; - if (((typeof element == 'object') || - Object.isFunction(element)) && + if (((typeof element == 'object') || + Object.isFunction(element)) && (element.length)) elements = element; else elements = $(element).childNodes; - + var options = Object.extend({ speed: 0.1, delay: 0.0 @@ -158,7 +158,7 @@ var Effect = { var options = Object.extend({ queue: { position:'end', scope:(element.id || 'global'), limit: 1 } }, arguments[2] || { }); - Effect[element.visible() ? + Effect[element.visible() ? Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); } }; @@ -170,20 +170,20 @@ Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; Effect.ScopedQueue = Class.create(Enumerable, { initialize: function() { this.effects = []; - this.interval = null; + this.interval = null; }, _each: function(iterator) { this.effects._each(iterator); }, add: function(effect) { var timestamp = new Date().getTime(); - - var position = Object.isString(effect.options.queue) ? + + var position = Object.isString(effect.options.queue) ? effect.options.queue : effect.options.queue.position; - + switch(position) { case 'front': - // move unstarted effects after this effect + // move unstarted effects after this effect this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { e.startOn += effect.finishOn; e.finishOn += effect.finishOn; @@ -197,13 +197,13 @@ Effect.ScopedQueue = Class.create(Enumerable, { timestamp = this.effects.pluck('finishOn').max() || timestamp; break; } - + effect.startOn += timestamp; effect.finishOn += timestamp; if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) this.effects.push(effect); - + if (!this.interval) this.interval = setInterval(this.loop.bind(this), 15); }, @@ -216,7 +216,7 @@ Effect.ScopedQueue = Class.create(Enumerable, { }, loop: function() { var timePos = new Date().getTime(); - for(var i=0, len=this.effects.length;i0) { @@ -432,9 +432,9 @@ Effect.Scale = Class.create(Effect.Base, { this.fontSizeType = fontSizeType; } }.bind(this)); - + this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; - + this.dims = null; if (this.options.scaleMode=='box') this.dims = [this.element.offsetHeight, this.element.offsetWidth]; @@ -511,7 +511,7 @@ Effect.ScrollTo = function(element) { var options = arguments[1] || { }, scrollOffsets = document.viewport.getScrollOffsets(), elementOffsets = $(element).cumulativeOffset(), - max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); + max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); if (options.offset) elementOffsets[1] += options.offset; @@ -531,9 +531,9 @@ Effect.Fade = function(element) { var options = Object.extend({ from: element.getOpacity() || 1.0, to: 0.0, - afterFinishInternal: function(effect) { + afterFinishInternal: function(effect) { if (effect.options.to!=0) return; - effect.element.hide().setStyle({opacity: oldOpacity}); + effect.element.hide().setStyle({opacity: oldOpacity}); } }, arguments[1] || { }); return new Effect.Opacity(element,options); @@ -549,15 +549,15 @@ Effect.Appear = function(element) { effect.element.forceRerendering(); }, beforeSetup: function(effect) { - effect.element.setOpacity(effect.options.from).show(); + effect.element.setOpacity(effect.options.from).show(); }}, arguments[1] || { }); return new Effect.Opacity(element,options); }; Effect.Puff = function(element) { element = $(element); - var oldStyle = { - opacity: element.getInlineOpacity(), + var oldStyle = { + opacity: element.getInlineOpacity(), position: element.getStyle('position'), top: element.style.top, left: element.style.left, @@ -565,10 +565,10 @@ Effect.Puff = function(element) { height: element.style.height }; return new Effect.Parallel( - [ new Effect.Scale(element, 200, - { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], - Object.extend({ duration: 1.0, + [ new Effect.Scale(element, 200, + { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), + new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], + Object.extend({ duration: 1.0, beforeSetupInternal: function(effect) { Position.absolutize(effect.effects[0].element) }, @@ -582,12 +582,12 @@ Effect.BlindUp = function(element) { element = $(element); element.makeClipping(); return new Effect.Scale(element, 0, - Object.extend({ scaleContent: false, - scaleX: false, + Object.extend({ scaleContent: false, + scaleX: false, restoreAfterFinish: true, afterFinishInternal: function(effect) { effect.element.hide().undoClipping(); - } + } }, arguments[1] || { }) ); }; @@ -595,15 +595,15 @@ Effect.BlindUp = function(element) { Effect.BlindDown = function(element) { element = $(element); var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, scaleX: false, scaleFrom: 0, scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, restoreAfterFinish: true, afterSetup: function(effect) { - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, + effect.element.makeClipping().setStyle({height: '0px'}).show(); + }, afterFinishInternal: function(effect) { effect.element.undoClipping(); } @@ -618,10 +618,10 @@ Effect.SwitchOff = function(element) { from: 0, transition: Effect.Transitions.flicker, afterFinishInternal: function(effect) { - new Effect.Scale(effect.element, 1, { + new Effect.Scale(effect.element, 1, { duration: 0.3, scaleFromCenter: true, scaleX: false, scaleContent: false, restoreAfterFinish: true, - beforeSetup: function(effect) { + beforeSetup: function(effect) { effect.element.makePositioned().makeClipping(); }, afterFinishInternal: function(effect) { @@ -639,16 +639,16 @@ Effect.DropOut = function(element) { left: element.getStyle('left'), opacity: element.getInlineOpacity() }; return new Effect.Parallel( - [ new Effect.Move(element, {x: 0, y: 100, sync: true }), + [ new Effect.Move(element, {x: 0, y: 100, sync: true }), new Effect.Opacity(element, { sync: true, to: 0.0 }) ], Object.extend( { duration: 0.5, beforeSetup: function(effect) { - effect.effects[0].element.makePositioned(); + effect.effects[0].element.makePositioned(); }, afterFinishInternal: function(effect) { effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); - } + } }, arguments[1] || { })); }; @@ -684,9 +684,9 @@ Effect.SlideDown = function(element) { // SlideDown need to have the content of the element wrapped in a container element with fixed height! var oldInnerBottom = element.down().getStyle('bottom'); var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, + return new Effect.Scale(element, 100, Object.extend({ + scaleContent: false, + scaleX: false, scaleFrom: window.opera ? 0 : 1, scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, restoreAfterFinish: true, @@ -694,11 +694,11 @@ Effect.SlideDown = function(element) { effect.element.makePositioned(); effect.element.down().makePositioned(); if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().setStyle({height: '0px'}).show(); + effect.element.makeClipping().setStyle({height: '0px'}).show(); }, afterUpdateInternal: function(effect) { effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); + (effect.dims[0] - effect.element.clientHeight) + 'px' }); }, afterFinishInternal: function(effect) { effect.element.undoClipping().undoPositioned(); @@ -712,8 +712,8 @@ Effect.SlideUp = function(element) { var oldInnerBottom = element.down().getStyle('bottom'); var elementDimensions = element.getDimensions(); return new Effect.Scale(element, window.opera ? 0 : 1, - Object.extend({ scaleContent: false, - scaleX: false, + Object.extend({ scaleContent: false, + scaleX: false, scaleMode: 'box', scaleFrom: 100, scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, @@ -723,7 +723,7 @@ Effect.SlideUp = function(element) { effect.element.down().makePositioned(); if (window.opera) effect.element.setStyle({top: ''}); effect.element.makeClipping().show(); - }, + }, afterUpdateInternal: function(effect) { effect.element.down().setStyle({bottom: (effect.dims[0] - effect.element.clientHeight) + 'px' }); @@ -736,15 +736,15 @@ Effect.SlideUp = function(element) { ); }; -// Bug in opera makes the TD containing this element expand for a instance after finish +// Bug in opera makes the TD containing this element expand for a instance after finish Effect.Squish = function(element) { - return new Effect.Scale(element, window.opera ? 1 : 0, { + return new Effect.Scale(element, window.opera ? 1 : 0, { restoreAfterFinish: true, beforeSetup: function(effect) { - effect.element.makeClipping(); - }, + effect.element.makeClipping(); + }, afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); + effect.element.hide().undoClipping(); } }); }; @@ -764,13 +764,13 @@ Effect.Grow = function(element) { width: element.style.width, opacity: element.getInlineOpacity() }; - var dims = element.getDimensions(); + var dims = element.getDimensions(); var initialMoveX, initialMoveY; var moveX, moveY; - + switch (options.direction) { case 'top-left': - initialMoveX = initialMoveY = moveX = moveY = 0; + initialMoveX = initialMoveY = moveX = moveY = 0; break; case 'top-right': initialMoveX = dims.width; @@ -795,11 +795,11 @@ Effect.Grow = function(element) { moveY = -dims.height / 2; break; } - + return new Effect.Move(element, { x: initialMoveX, y: initialMoveY, - duration: 0.01, + duration: 0.01, beforeSetup: function(effect) { effect.element.hide().makeClipping().makePositioned(); }, @@ -808,14 +808,14 @@ Effect.Grow = function(element) { [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), new Effect.Scale(effect.element, 100, { - scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, + scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) ], Object.extend({ beforeSetup: function(effect) { - effect.effects[0].element.setStyle({height: '0px'}).show(); + effect.effects[0].element.setStyle({height: '0px'}).show(); }, afterFinishInternal: function(effect) { - effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); + effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); } }, options) ) @@ -840,7 +840,7 @@ Effect.Shrink = function(element) { var dims = element.getDimensions(); var moveX, moveY; - + switch (options.direction) { case 'top-left': moveX = moveY = 0; @@ -857,19 +857,19 @@ Effect.Shrink = function(element) { moveX = dims.width; moveY = dims.height; break; - case 'center': + case 'center': moveX = dims.width / 2; moveY = dims.height / 2; break; } - + return new Effect.Parallel( [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) - ], Object.extend({ + ], Object.extend({ beforeStartInternal: function(effect) { - effect.effects[0].element.makePositioned().makeClipping(); + effect.effects[0].element.makePositioned().makeClipping(); }, afterFinishInternal: function(effect) { effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } @@ -884,7 +884,7 @@ Effect.Pulsate = function(element) { var transition = options.transition || Effect.Transitions.sinoidal; var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) }; reverser.bind(transition); - return new Effect.Opacity(element, + return new Effect.Opacity(element, Object.extend(Object.extend({ duration: 2.0, from: 0, afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } }, options), {transition: reverser})); @@ -898,12 +898,12 @@ Effect.Fold = function(element) { width: element.style.width, height: element.style.height }; element.makeClipping(); - return new Effect.Scale(element, 5, Object.extend({ + return new Effect.Scale(element, 5, Object.extend({ scaleContent: false, scaleX: false, afterFinishInternal: function(effect) { - new Effect.Scale(element, 1, { - scaleContent: false, + new Effect.Scale(element, 1, { + scaleContent: false, scaleY: false, afterFinishInternal: function(effect) { effect.element.hide().undoClipping().setStyle(oldStyle); @@ -918,7 +918,7 @@ Effect.Morph = Class.create(Effect.Base, { var options = Object.extend({ style: { } }, arguments[1] || { }); - + if (!Object.isString(options.style)) this.style = $H(options.style); else { if (options.style.include(':')) @@ -941,13 +941,13 @@ Effect.Morph = Class.create(Effect.Base, { } this.start(options); }, - + setup: function(){ function parseColor(color){ if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; color = color.parseColor(); return $R(0,2).map(function(i){ - return parseInt( color.slice(i*2+1,i*2+3), 16 ) + return parseInt( color.slice(i*2+1,i*2+3), 16 ) }); } this.transforms = this.style.map(function(pair){ @@ -967,9 +967,9 @@ Effect.Morph = Class.create(Effect.Base, { } var originalValue = this.element.getStyle(property); - return { - style: property.camelize(), - originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), + return { + style: property.camelize(), + originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), targetValue: unit=='color' ? parseColor(value) : value, unit: unit }; @@ -986,7 +986,7 @@ Effect.Morph = Class.create(Effect.Base, { update: function(position) { var style = { }, transform, i = this.transforms.length; while(i--) - style[(transform = this.transforms[i]).style] = + style[(transform = this.transforms[i]).style] = transform.unit=='color' ? '#'+ (Math.round(transform.originalValue[0]+ (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + @@ -995,7 +995,7 @@ Effect.Morph = Class.create(Effect.Base, { (Math.round(transform.originalValue[2]+ (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : (transform.originalValue + - (transform.targetValue - transform.originalValue) * position).toFixed(3) + + (transform.targetValue - transform.originalValue) * position).toFixed(3) + (transform.unit === null ? '' : transform.unit); this.element.setStyle(style, true); } @@ -1032,7 +1032,7 @@ Effect.Transform = Class.create({ }); Element.CSS_PROPERTIES = $w( - 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + + 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + @@ -1041,7 +1041,7 @@ Element.CSS_PROPERTIES = $w( 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + 'right textIndent top width wordSpacing zIndex'); - + Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; String.__parseStyleElement = document.createElement('div'); @@ -1053,11 +1053,11 @@ String.prototype.parseStyle = function(){ String.__parseStyleElement.innerHTML = '
    '; style = String.__parseStyleElement.childNodes[0].style; } - + Element.CSS_PROPERTIES.each(function(property){ - if (style[property]) styleRules.set(property, style[property]); + if (style[property]) styleRules.set(property, style[property]); }); - + if (Prototype.Browser.IE && this.include('opacity')) styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); @@ -1106,7 +1106,7 @@ Effect.Methods = { $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ 'pulsate shake puff squish switchOff dropOut').each( - function(effect) { + function(effect) { Effect.Methods[effect] = function(element, options){ element = $(element); Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); @@ -1115,7 +1115,7 @@ $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ } ); -$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( +$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( function(f) { Effect.Methods[f] = Element[f]; } ); diff --git a/1.3/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js b/1.3/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js index 6cfe36e..781359b 100644 --- a/1.3/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js +++ b/1.3/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js @@ -1,7 +1,7 @@ // script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// +// // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including @@ -9,7 +9,7 @@ // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // @@ -35,15 +35,15 @@ var Scriptaculous = { var r = versionString.split('.'); return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]); } - - if((typeof Prototype=='undefined') || - (typeof Element == 'undefined') || + + if((typeof Prototype=='undefined') || + (typeof Element == 'undefined') || (typeof Element.Methods=='undefined') || - (convertVersionString(Prototype.Version) < + (convertVersionString(Prototype.Version) < convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE))) throw("script.aculo.us requires the Prototype JavaScript framework >= " + Scriptaculous.REQUIRED_PROTOTYPE); - + $A(document.getElementsByTagName("script")).findAll( function(s) { return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) }).each( function(s) { diff --git a/1.3/test/otherlibs/scriptaculous/1.8.1/slider.js b/1.3/test/otherlibs/scriptaculous/1.8.1/slider.js index cc46fe3..e0591d7 100644 --- a/1.3/test/otherlibs/scriptaculous/1.8.1/slider.js +++ b/1.3/test/otherlibs/scriptaculous/1.8.1/slider.js @@ -1,6 +1,6 @@ // script.aculo.us slider.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008 -// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs +// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ @@ -16,13 +16,13 @@ if (!Control) var Control = { }; Control.Slider = Class.create({ initialize: function(handle, track, options) { var slider = this; - + if (Object.isArray(handle)) { this.handles = handle.collect( function(e) { return $(e) }); } else { this.handles = [$(handle)]; } - + this.track = $(track); this.options = options || { }; @@ -30,7 +30,7 @@ Control.Slider = Class.create({ this.increment = this.options.increment || 1; this.step = parseInt(this.options.step || '1'); this.range = this.options.range || $R(0,1); - + this.value = 0; // assure backwards compat this.values = this.handles.map( function() { return 0 }); this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; @@ -45,13 +45,13 @@ Control.Slider = Class.create({ // Will be used to align the handle onto the track, if necessary this.alignX = parseInt(this.options.alignX || '0'); this.alignY = parseInt(this.options.alignY || '0'); - + this.trackLength = this.maximumOffset() - this.minimumOffset(); - this.handleLength = this.isVertical() ? - (this.handles[0].offsetHeight != 0 ? - this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : - (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : + this.handleLength = this.isVertical() ? + (this.handles[0].offsetHeight != 0 ? + this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : + (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : this.handles[0].style.width.replace(/px$/,"")); this.active = false; @@ -75,20 +75,20 @@ Control.Slider = Class.create({ this.handles.each( function(h,i) { i = slider.handles.length-1-i; slider.setValue(parseFloat( - (Object.isArray(slider.options.sliderValue) ? - slider.options.sliderValue[i] : slider.options.sliderValue) || + (Object.isArray(slider.options.sliderValue) ? + slider.options.sliderValue[i] : slider.options.sliderValue) || slider.range.start), i); h.makePositioned().observe("mousedown", slider.eventMouseDown); }); - + this.track.observe("mousedown", this.eventMouseDown); document.observe("mouseup", this.eventMouseUp); document.observe("mousemove", this.eventMouseMove); - + this.initialized = true; }, dispose: function() { - var slider = this; + var slider = this; Event.stopObserving(this.track, "mousedown", this.eventMouseDown); Event.stopObserving(document, "mouseup", this.eventMouseUp); Event.stopObserving(document, "mousemove", this.eventMouseMove); @@ -101,12 +101,12 @@ Control.Slider = Class.create({ }, setEnabled: function(){ this.disabled = false; - }, + }, getNearestValue: function(value){ if (this.allowedValues){ if (value >= this.allowedValues.max()) return(this.allowedValues.max()); if (value <= this.allowedValues.min()) return(this.allowedValues.min()); - + var offset = Math.abs(this.allowedValues[0] - value); var newValue = this.allowedValues[0]; this.allowedValues.each( function(v) { @@ -114,7 +114,7 @@ Control.Slider = Class.create({ if (currentOffset <= offset){ newValue = v; offset = currentOffset; - } + } }); return newValue; } @@ -138,28 +138,28 @@ Control.Slider = Class.create({ sliderValue = this.getNearestValue(sliderValue); this.values[handleIdx] = sliderValue; this.value = this.values[0]; // assure backwards compat - - this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = + + this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = this.translateToPx(sliderValue); - + this.drawSpans(); if (!this.dragging || !this.event) this.updateFinished(); }, setValueBy: function(delta, handleIdx) { - this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, + this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, handleIdx || this.activeHandleIdx || 0); }, translateToPx: function(value) { return Math.round( - ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * + ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * (value - this.range.start)) + "px"; }, translateToValue: function(offset) { - return ((offset/(this.trackLength-this.handleLength) * + return ((offset/(this.trackLength-this.handleLength) * (this.range.end-this.range.start)) + this.range.start); }, getRange: function(range) { - var v = this.values.sortBy(Prototype.K); + var v = this.values.sortBy(Prototype.K); range = range || 0; return $R(v[range],v[range+1]); }, @@ -167,12 +167,12 @@ Control.Slider = Class.create({ return(this.isVertical() ? this.alignY : this.alignX); }, maximumOffset: function(){ - return(this.isVertical() ? + return(this.isVertical() ? (this.track.offsetHeight != 0 ? this.track.offsetHeight : - this.track.style.height.replace(/px$/,"")) - this.alignY : - (this.track.offsetWidth != 0 ? this.track.offsetWidth : + this.track.style.height.replace(/px$/,"")) - this.alignY : + (this.track.offsetWidth != 0 ? this.track.offsetWidth : this.track.style.width.replace(/px$/,"")) - this.alignX); - }, + }, isVertical: function(){ return (this.axis == 'vertical'); }, @@ -184,7 +184,7 @@ Control.Slider = Class.create({ this.setSpan(this.options.startSpan, $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); if (this.options.endSpan) - this.setSpan(this.options.endSpan, + this.setSpan(this.options.endSpan, $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); }, setSpan: function(span, range) { @@ -204,14 +204,14 @@ Control.Slider = Class.create({ if (Event.isLeftClick(event)) { if (!this.disabled){ this.active = true; - + var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; var track = handle; if (track==this.track) { - var offsets = Position.cumulativeOffset(this.track); + var offsets = Position.cumulativeOffset(this.track); this.event = event; - this.setValue(this.translateToValue( + this.setValue(this.translateToValue( (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) )); var offsets = Position.cumulativeOffset(this.activeHandle); @@ -219,14 +219,14 @@ Control.Slider = Class.create({ this.offsetY = (pointer[1] - offsets[1]); } else { // find the handle (prevents issues with Safari) - while((this.handles.indexOf(handle) == -1) && handle.parentNode) + while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; - + if (this.handles.indexOf(handle)!=-1) { this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); - + var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); @@ -261,14 +261,14 @@ Control.Slider = Class.create({ } this.active = false; this.dragging = false; - }, + }, finishDrag: function(event, success) { this.active = false; this.dragging = false; this.updateFinished(); }, updateFinished: function() { - if (this.initialized && this.options.onChange) + if (this.initialized && this.options.onChange) this.options.onChange(this.values.length>1 ? this.values : this.value, this); this.event = null; } diff --git a/1.3/test/otherlibs/scriptaculous/1.8.1/sound.js b/1.3/test/otherlibs/scriptaculous/1.8.1/sound.js index eba3843..6d193c7 100644 --- a/1.3/test/otherlibs/scriptaculous/1.8.1/sound.js +++ b/1.3/test/otherlibs/scriptaculous/1.8.1/sound.js @@ -23,7 +23,7 @@ Sound = { var options = Object.extend({ track: 'global', url: url, replace: false }, arguments[1] || {}); - + if(options.replace && this.tracks[options.track]) { $R(0, this.tracks[options.track].id).each(function(id){ var sound = $('sound_'+options.track+'_'+id); @@ -32,14 +32,14 @@ Sound = { }) this.tracks[options.track] = null; } - + if(!this.tracks[options.track]) this.tracks[options.track] = { id: 0 } else this.tracks[options.track].id++; - + options.id = this.tracks[options.track].id; - $$('body')[0].insert( + $$('body')[0].insert( Prototype.Browser.IE ? new Element('bgsound',{ id: 'sound_'+options.track+'_'+options.id, src: options.url, loop: 1, autostart: true diff --git a/1.3/test/otherlibs/scriptaculous/1.8.1/unittest.js b/1.3/test/otherlibs/scriptaculous/1.8.1/unittest.js index 7eed8a5..f14a75b 100644 --- a/1.3/test/otherlibs/scriptaculous/1.8.1/unittest.js +++ b/1.3/test/otherlibs/scriptaculous/1.8.1/unittest.js @@ -19,10 +19,10 @@ Event.simulateMouse = function(element, eventName) { metaKey: false }, arguments[2] || {}); var oEvent = document.createEvent("MouseEvents"); - oEvent.initMouseEvent(eventName, true, true, document.defaultView, - options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, + oEvent.initMouseEvent(eventName, true, true, document.defaultView, + options.buttons, options.pointerX, options.pointerY, options.pointerX, options.pointerY, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, $(element)); - + if(this.mark) Element.remove(this.mark); this.mark = document.createElement('div'); this.mark.appendChild(document.createTextNode(" ")); @@ -34,10 +34,10 @@ Event.simulateMouse = function(element, eventName) { this.mark.style.height = "5px;"; this.mark.style.borderTop = "1px solid red;" this.mark.style.borderLeft = "1px solid red;" - + if(this.step) alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options)); - + $(element).dispatchEvent(oEvent); }; @@ -55,7 +55,7 @@ Event.simulateKey = function(element, eventName) { }, arguments[2] || {}); var oEvent = document.createEvent("KeyEvents"); - oEvent.initKeyEvent(eventName, true, true, window, + oEvent.initKeyEvent(eventName, true, true, window, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.keyCode, options.charCode ); $(element).dispatchEvent(oEvent); @@ -123,7 +123,7 @@ Test.Unit.Logger.prototype = { _toHTML: function(txt) { return txt.escapeHTML().replace(/\n/g,"
    "); }, - addLinksToResults: function(){ + addLinksToResults: function(){ $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log td.title = "Run only this test" Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;}); @@ -162,7 +162,7 @@ Test.Unit.Runner.prototype = { if(/^test/.test(testcase)) { this.tests.push( new Test.Unit.Testcase( - this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, + this.options.context ? ' -> ' + this.options.titles[testcase] : testcase, testcases[testcase], testcases["setup"], testcases["teardown"] )); } @@ -203,7 +203,7 @@ Test.Unit.Runner.prototype = { }, postResults: function() { if (this.options.resultsURL) { - new Ajax.Request(this.options.resultsURL, + new Ajax.Request(this.options.resultsURL, { method: 'get', parameters: 'result=' + this.getResult(), asynchronous: false }); } }, @@ -240,9 +240,9 @@ Test.Unit.Runner.prototype = { errors += this.tests[i].errors; } return ( - (this.options.context ? this.options.context + ': ': '') + - this.tests.length + " tests, " + - assertions + " assertions, " + + (this.options.context ? this.options.context + ': ': '') + + this.tests.length + " tests, " + + assertions + " assertions, " + failures + " failures, " + errors + " errors"); } @@ -258,7 +258,7 @@ Test.Unit.Assertions.prototype = { }, summary: function() { return ( - this.assertions + " assertions, " + + this.assertions + " assertions, " + this.failures + " failures, " + this.errors + " errors" + "\n" + this.messages.join("\n")); @@ -284,55 +284,55 @@ Test.Unit.Assertions.prototype = { }, assert: function(expression) { var message = arguments[1] || 'assert: got "' + Test.Unit.inspect(expression) + '"'; - try { expression ? this.pass() : + try { expression ? this.pass() : this.fail(message); } catch(e) { this.error(e); } }, assertEqual: function(expected, actual) { var message = arguments[2] || "assertEqual"; try { (expected == actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertInspect: function(expected, actual) { var message = arguments[2] || "assertInspect"; try { (expected == actual.inspect()) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, assertEnumEqual: function(expected, actual) { var message = arguments[2] || "assertEnumEqual"; - try { $A(expected).length == $A(actual).length && + try { $A(expected).length == $A(actual).length && expected.zip(actual).all(function(pair) { return pair[0] == pair[1] }) ? - this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + + this.pass() : this.fail(message + ': expected ' + Test.Unit.inspect(expected) + ', actual ' + Test.Unit.inspect(actual)); } catch(e) { this.error(e); } }, assertNotEqual: function(expected, actual) { var message = arguments[2] || "assertNotEqual"; - try { (expected != actual) ? this.pass() : + try { (expected != actual) ? this.pass() : this.fail(message + ': got "' + Test.Unit.inspect(actual) + '"'); } catch(e) { this.error(e); } }, - assertIdentical: function(expected, actual) { - var message = arguments[2] || "assertIdentical"; - try { (expected === actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } + assertIdentical: function(expected, actual) { + var message = arguments[2] || "assertIdentical"; + try { (expected === actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } }, - assertNotIdentical: function(expected, actual) { - var message = arguments[2] || "assertNotIdentical"; - try { !(expected === actual) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + - '", actual "' + Test.Unit.inspect(actual) + '"'); } - catch(e) { this.error(e); } + assertNotIdentical: function(expected, actual) { + var message = arguments[2] || "assertNotIdentical"; + try { !(expected === actual) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + '", actual "' + Test.Unit.inspect(actual) + '"'); } + catch(e) { this.error(e); } }, assertNull: function(obj) { var message = arguments[1] || 'assertNull' - try { (obj==null) ? this.pass() : + try { (obj==null) ? this.pass() : this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); } catch(e) { this.error(e); } }, @@ -353,38 +353,38 @@ Test.Unit.Assertions.prototype = { }, assertType: function(expected, actual) { var message = arguments[2] || 'assertType'; - try { - (actual.constructor == expected) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + try { + (actual.constructor == expected) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + (actual.constructor) + '"'); } catch(e) { this.error(e); } }, assertNotOfType: function(expected, actual) { var message = arguments[2] || 'assertNotOfType'; - try { - (actual.constructor != expected) ? this.pass() : - this.fail(message + ': expected "' + Test.Unit.inspect(expected) + + try { + (actual.constructor != expected) ? this.pass() : + this.fail(message + ': expected "' + Test.Unit.inspect(expected) + '", actual "' + (actual.constructor) + '"'); } catch(e) { this.error(e); } }, assertInstanceOf: function(expected, actual) { var message = arguments[2] || 'assertInstanceOf'; - try { - (actual instanceof expected) ? this.pass() : + try { + (actual instanceof expected) ? this.pass() : this.fail(message + ": object was not an instance of the expected type"); } - catch(e) { this.error(e); } + catch(e) { this.error(e); } }, assertNotInstanceOf: function(expected, actual) { var message = arguments[2] || 'assertNotInstanceOf'; - try { - !(actual instanceof expected) ? this.pass() : + try { + !(actual instanceof expected) ? this.pass() : this.fail(message + ": object was an instance of the not expected type"); } - catch(e) { this.error(e); } + catch(e) { this.error(e); } }, assertRespondsTo: function(method, obj) { var message = arguments[2] || 'assertRespondsTo'; try { - (obj[method] && typeof obj[method] == 'function') ? this.pass() : + (obj[method] && typeof obj[method] == 'function') ? this.pass() : this.fail(message + ": object doesn't respond to [" + method + "]"); } catch(e) { this.error(e); } }, @@ -393,7 +393,7 @@ Test.Unit.Assertions.prototype = { try { var m = obj[method]; if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; - m() ? this.pass() : + m() ? this.pass() : this.fail(message + ": method returned false"); } catch(e) { this.error(e); } }, @@ -402,17 +402,17 @@ Test.Unit.Assertions.prototype = { try { var m = obj[method]; if(!m) m = obj['is'+method.charAt(0).toUpperCase()+method.slice(1)]; - !m() ? this.pass() : + !m() ? this.pass() : this.fail(message + ": method returned true"); } catch(e) { this.error(e); } }, assertRaise: function(exceptionName, method) { var message = arguments[2] || 'assertRaise'; - try { + try { method(); this.fail(message + ": exception expected but none was raised"); } catch(e) { - ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); + ((exceptionName == null) || (e.name==exceptionName)) ? this.pass() : this.error(e); } }, assertElementsMatch: function() { @@ -434,7 +434,7 @@ Test.Unit.Assertions.prototype = { var startAt = new Date(); (iterations || 1).times(operation); var timeTaken = ((new Date())-startAt); - this.info((arguments[2] || 'Operation') + ' finished ' + + this.info((arguments[2] || 'Operation') + ' finished ' + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); return timeTaken; }, @@ -444,7 +444,7 @@ Test.Unit.Assertions.prototype = { this.assertNotNull(element); if(element.style && Element.getStyle(element, 'display') == 'none') return false; - + return this._isVisible(element.parentNode); }, assertNotVisible: function(element) { @@ -457,7 +457,7 @@ Test.Unit.Assertions.prototype = { var startAt = new Date(); (iterations || 1).times(operation); var timeTaken = ((new Date())-startAt); - this.info((arguments[2] || 'Operation') + ' finished ' + + this.info((arguments[2] || 'Operation') + ' finished ' + iterations + ' iterations in ' + (timeTaken/1000)+'s' ); return timeTaken; } @@ -468,7 +468,7 @@ Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.p initialize: function(name, test, setup, teardown) { Test.Unit.Assertions.prototype.initialize.bind(this)(); this.name = name; - + if(typeof test == 'string') { test = test.gsub(/(\.should[^\(]+\()/,'#{0}this,'); test = test.gsub(/(\.should[^\(]+)\(this,\)/,'#{1}(this)'); @@ -478,7 +478,7 @@ Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.p } else { this.test = test || function() {}; } - + this.setup = setup || function() {}; this.teardown = teardown || function() {}; this.isWaiting = false; @@ -519,23 +519,23 @@ Test.setupBDDExtensionMethods = function(){ shouldNotBeAn: 'assertNotOfType', shouldBeNull: 'assertNull', shouldNotBeNull: 'assertNotNull', - + shouldBe: 'assertReturnsTrue', shouldNotBe: 'assertReturnsFalse', shouldRespondTo: 'assertRespondsTo' }; - var makeAssertion = function(assertion, args, object) { + var makeAssertion = function(assertion, args, object) { this[assertion].apply(this,(args || []).concat([object])); } - - Test.BDDMethods = {}; - $H(METHODMAP).each(function(pair) { - Test.BDDMethods[pair.key] = function() { - var args = $A(arguments); - var scope = args.shift(); - makeAssertion.apply(scope, [pair.value, args, this]); }; + + Test.BDDMethods = {}; + $H(METHODMAP).each(function(pair) { + Test.BDDMethods[pair.key] = function() { + var args = $A(arguments); + var scope = args.shift(); + makeAssertion.apply(scope, [pair.value, args, this]); }; }); - + [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each( function(p){ Object.extend(p, Test.BDDMethods) } ); @@ -543,7 +543,7 @@ Test.setupBDDExtensionMethods = function(){ Test.context = function(name, spec, log){ Test.setupBDDExtensionMethods(); - + var compiledSpec = {}; var titles = {}; for(specName in spec) { @@ -557,7 +557,7 @@ Test.context = function(name, spec, log){ var body = spec[specName].toString().split('\n').slice(1); if(/^\{/.test(body[0])) body = body.slice(1); body.pop(); - body = body.map(function(statement){ + body = body.map(function(statement){ return statement.strip() }); compiledSpec[testName] = body.join('\n'); diff --git a/1.3/test/unit/ajax.js b/1.3/test/unit/ajax.js index a334f0d..933f15c 100644 --- a/1.3/test/unit/ajax.js +++ b/1.3/test/unit/ajax.js @@ -9,12 +9,12 @@ if ( !isLocal ) { test("jQuery.ajax() - success callbacks", function() { expect( 8 ); - + jQuery.ajaxSetup({ timeout: 0 }); - + stop(); - - setTimeout(function(){ + + setTimeout(function(){ jQuery('#foo').ajaxStart(function(){ ok( true, "ajaxStart" ); }).ajaxStop(function(){ @@ -29,7 +29,7 @@ test("jQuery.ajax() - success callbacks", function() { }).ajaxSuccess(function(){ ok( true, "ajaxSuccess" ); }); - + jQuery.ajax({ url: url("data/name.html"), beforeSend: function(){ ok(true, "beforeSend"); }, @@ -43,7 +43,7 @@ test("jQuery.ajax() - success callbacks", function() { test("jQuery.ajax() - error callbacks", function() { expect( 8 ); stop(); - + jQuery('#foo').ajaxStart(function(){ ok( true, "ajaxStart" ); }).ajaxStop(function(){ @@ -58,9 +58,9 @@ test("jQuery.ajax() - error callbacks", function() { }).ajaxSuccess(function(){ ok( false, "ajaxSuccess" ); }); - + jQuery.ajaxSetup({ timeout: 500 }); - + jQuery.ajax({ url: url("data/name.php?wait=5"), beforeSend: function(){ ok(true, "beforeSend"); }, @@ -73,7 +73,7 @@ test("jQuery.ajax() - error callbacks", function() { test("jQuery.ajax() - disabled globals", function() { expect( 3 ); stop(); - + jQuery('#foo').ajaxStart(function(){ ok( false, "ajaxStart" ); }).ajaxStop(function(){ @@ -87,7 +87,7 @@ test("jQuery.ajax() - disabled globals", function() { }).ajaxSuccess(function(){ ok( false, "ajaxSuccess" ); }); - + jQuery.ajax({ global: false, url: url("data/name.html"), @@ -119,13 +119,13 @@ test("jQuery.ajax - xml: non-namespace elements inside namespaced elements", fun test("jQuery.ajax - beforeSend", function() { expect(1); stop(); - + var check = false; - + jQuery.ajaxSetup({ timeout: 0 }); - + jQuery.ajax({ - url: url("data/name.html"), + url: url("data/name.html"), beforeSend: function(xml) { check = true; }, @@ -139,7 +139,7 @@ test("jQuery.ajax - beforeSend", function() { test("jQuery.ajax - beforeSend, cancel request (#2688)", function() { expect(2); var request = jQuery.ajax({ - url: url("data/name.html"), + url: url("data/name.html"), beforeSend: function() { ok( true, "beforeSend got called, canceling" ); return false; @@ -163,11 +163,11 @@ window.testFoo = undefined; test("jQuery.ajax - dataType html", function() { expect(5); stop(); - + var verifyEvaluation = function() { equals( testFoo, "foo", 'Check if script was evaluated for datatype html' ); equals( foobar, "bar", 'Check if script src was evaluated for datatype html' ); - + start(); }; @@ -184,27 +184,27 @@ test("jQuery.ajax - dataType html", function() { test("serialize()", function() { expect(6); - + equals( jQuery('#form').serialize(), "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2", 'Check form serialization as query string'); - + equals( jQuery('#form :input').serialize(), "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2", 'Check input serialization as query string'); - - equals( jQuery('#testForm').serialize(), - 'T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=', + + equals( jQuery('#testForm').serialize(), + 'T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=', 'Check form serialization as query string'); - - equals( jQuery('#testForm :input').serialize(), - 'T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=', + + equals( jQuery('#testForm :input').serialize(), + 'T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=', 'Check input serialization as query string'); - + equals( jQuery('#form, #testForm').serialize(), "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", 'Multiple form serialization as query string'); - + equals( jQuery('#form, #testForm :input').serialize(), "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=", 'Mixed form/input serialization as query string'); @@ -214,13 +214,13 @@ test("jQuery.param()", function() { expect(4); var params = {foo:"bar", baz:42, quux:"All your base are belong to us"}; equals( jQuery.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" ); - + params = {someName: [1, 2, 3], regularThing: "blah" }; equals( jQuery.param(params), "someName=1&someName=2&someName=3®ularThing=blah", "with array" ); - + params = {"foo[]":["baz", 42, "All your base are belong to us"]}; equals( jQuery.param(params), "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", "more array" ); - + params = {"foo[bar]":"baz", "foo[beep]":42, "foo[quux]":"All your base are belong to us"}; equals( jQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" ); }); @@ -240,7 +240,7 @@ test("synchronous request with callbacks", function() { test("pass-through request object", function() { expect(8); stop(); - + var target = "data/name.html"; var successCount = 0; var errorCount = 0; @@ -256,10 +256,10 @@ test("pass-through request object", function() { equals(successCount, 5, "Check all ajax calls successful"); equals(errorCount, 0, "Check no ajax errors (status" + errorEx + ")"); jQuery("#foo").unbind('ajaxError'); - + start(); }); - + ok( jQuery.get(url(target), success), "get" ); ok( jQuery.post(url(target), success), "post" ); ok( jQuery.getScript(url("data/test.js"), success), "script" ); @@ -270,7 +270,7 @@ test("pass-through request object", function() { test("ajax cache", function () { expect(18); stop(); - + var count = 0; jQuery("#firstp").bind("ajaxSuccess", function (e, xml, s) { @@ -315,7 +315,7 @@ test("global ajaxSettings", function() { t.data = { zoo: 'a', ping: 'b' }; jQuery.ajax(t); ok( t.url.indexOf('ping') > -1 && t.url.indexOf('zoo') > -1 && t.url.indexOf('foo') > -1 && t.url.indexOf('bar') > -1, "Check extending { zoo: 'a', ping: 'b' }" ); - + jQuery.ajaxSettings = tmp; }); @@ -359,11 +359,11 @@ test("load(String, Function) - simple: inject text into DOM", function() { test("load(String, Function) - check scripts", function() { expect(7); stop(); - + var verifyEvaluation = function() { equals( foobar, "bar", 'Check if script src was evaluated after load' ); equals( jQuery('#ap').html(), 'bar', 'Check if script evaluation has modified DOM'); - + start(); }; jQuery('#first').load(url('data/test.html'), function() { @@ -381,7 +381,7 @@ test("load(String, Function) - check file with only a script tag", function() { jQuery('#first').load(url('data/test2.html'), function() { equals( jQuery('#foo').html(), 'foo', 'Check if script evaluation has modified DOM'); equals( testFoo, "foo", 'Check if script was evaluated after load' ); - + start(); }); }); @@ -389,9 +389,9 @@ test("load(String, Function) - check file with only a script tag", function() { test("load(String, Object, Function)", function() { expect(2); stop(); - + jQuery('
    ').load(url('data/params_html.php'), { foo:3, bar:'ok' }, function() { - var $post = jQuery(this).find('#post'); + var $post = jQuery(this).find('#post'); equals( $post.find('#foo').text(), '3', 'Check if a hash of data is passed correctly'); equals( $post.find('#bar').text(), 'ok', 'Check if a hash of data is passed correctly'); start(); @@ -401,9 +401,9 @@ test("load(String, Object, Function)", function() { test("load(String, String, Function)", function() { expect(2); stop(); - + jQuery('
    ').load(url('data/params_html.php'), 'foo=3&bar=ok', function() { - var $get = jQuery(this).find('#get'); + var $get = jQuery(this).find('#get'); equals( $get.find('#foo').text(), '3', 'Check if a string of data is passed correctly'); equals( $get.find('#bar').text(), 'ok', 'Check if a of data is passed correctly'); start(); @@ -726,11 +726,11 @@ test("jQuery.post(String, Hash, Function) - simple with xml", function() { test("jQuery.ajaxSetup({timeout: Number}) - with global timeout", function() { stop(); - + var passed = 0; jQuery.ajaxSetup({timeout: 1000}); - + var pass = function() { passed++; if ( passed == 2 ) { @@ -739,21 +739,21 @@ test("jQuery.ajaxSetup({timeout: Number}) - with global timeout", function() { start(); } }; - + var fail = function(a,b,c) { ok( false, 'Check for timeout failed ' + a + ' ' + b ); start(); }; - + jQuery('#main').ajaxError(pass); - + jQuery.ajax({ type: "GET", url: url("data/name.php?wait=5"), error: pass, success: fail }); - + // reset timeout jQuery.ajaxSetup({timeout: 0}); }); diff --git a/1.3/test/unit/core.js b/1.3/test/unit/core.js index 80a9335..400406f 100644 --- a/1.3/test/unit/core.js +++ b/1.3/test/unit/core.js @@ -56,27 +56,27 @@ test("selector state", function() { expect(28); var test; - + test = jQuery(); equals( test.selector, "", "Empty jQuery Selector" ); equals( test.context, document, "Empty jQuery Context" ); - + test = jQuery(document); equals( test.selector, "", "Document Selector" ); equals( test.context, document, "Document Context" ); - + test = jQuery(document.body); equals( test.selector, "", "Body Selector" ); equals( test.context, document.body, "Body Context" ); - + test = jQuery("#main"); equals( test.selector, "#main", "#main Selector" ); equals( test.context, document, "#main Context" ); - + test = jQuery("#main", document); equals( test.selector, "#main", "#main Selector" ); equals( test.context, document, "#main Context" ); - + test = jQuery("#main", document.body); equals( test.selector, "#main", "#main Selector" ); equals( test.context, document.body, "#main Context" ); @@ -85,7 +85,7 @@ test("selector state", function() { test = jQuery(test); equals( test.selector, "#main", "#main Selector" ); equals( test.context, document.body, "#main Context" ); - + test = jQuery(document.body).find("#main"); equals( test.selector, "#main", "#main find Selector" ); equals( test.context, document.body, "#main find Context" ); @@ -93,23 +93,23 @@ test("selector state", function() { test = jQuery("#main").filter("div"); equals( test.selector, "#main.filter(div)", "#main filter Selector" ); equals( test.context, document, "#main filter Context" ); - + test = jQuery("#main").not("div"); equals( test.selector, "#main.not(div)", "#main not Selector" ); equals( test.context, document, "#main not Context" ); - + test = jQuery("#main").filter("div").not("div"); equals( test.selector, "#main.filter(div).not(div)", "#main filter, not Selector" ); equals( test.context, document, "#main filter, not Context" ); - + test = jQuery("#main").filter("div").not("div").end(); equals( test.selector, "#main.filter(div)", "#main filter, not, end Selector" ); equals( test.context, document, "#main filter, not, end Context" ); - + test = jQuery("#main").parent("body"); equals( test.selector, "#main.parent(body)", "#main parent Selector" ); equals( test.context, document, "#main parent Context" ); - + test = jQuery("#main").eq(0); equals( test.selector, "#main.slice(0,1)", "#main eq Selector" ); equals( test.context, document, "#main eq Context" ); @@ -415,19 +415,19 @@ test("attr(String)", function() { ok( $body.attr('foo') === undefined, 'Make sure that a non existent attribute returns undefined' ); ok( $body.attr('nextSibling') === null, 'Make sure a null expando returns null' ); - + body.setAttribute('foo', 'baz'); equals( $body.attr('foo'), 'baz', 'Make sure the dom attribute is retrieved when no expando is found' ); - + body.foo = 'bar'; equals( $body.attr('foo'), 'bar', 'Make sure the expando is preferred over the dom attribute' ); - + $body.attr('foo','cool'); equals( $body.attr('foo'), 'cool', 'Make sure that setting works well when both expando and dom attribute are available' ); - + body.foo = undefined; ok( $body.attr('foo') === undefined, 'Make sure the expando is preferred over the dom attribute, even if undefined' ); - + body.removeAttribute('foo'); // Cleanup }); @@ -523,7 +523,7 @@ test("attr(String, Object)", function() { } ok( thrown, "Exception thrown when trying to change type property" ); equals( "checkbox", jQuery(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" ); - + var check = jQuery(""); var thrown = true; try { @@ -587,7 +587,7 @@ test("attr('tabindex', value)", function() { // set a negative string element.attr('tabindex', '-1'); equals(element.attr('tabindex'), -1, 'set tabindex to -1 (string)'); - + // set a positive number element.attr('tabindex', 1); equals(element.attr('tabindex'), 1, 'set tabindex to 1 (number)'); @@ -599,7 +599,7 @@ test("attr('tabindex', value)", function() { // set a negative number element.attr('tabindex', -1); equals(element.attr('tabindex'), -1, 'set tabindex to -1 (number)'); - + element = jQuery('#linkWithTabIndex'); equals(element.attr('tabindex'), 2, 'start with tabindex 2'); @@ -1226,17 +1226,17 @@ test("is(String)", function() { test("jQuery.merge()", function() { expect(6); - + var parse = jQuery.merge; - + same( parse([],[]), [], "Empty arrays" ); - + same( parse([1],[2]), [1,2], "Basic" ); same( parse([1,2],[3,4]), [1,2,3,4], "Basic" ); - + same( parse([1,2],[]), [1,2], "Second empty" ); - same( parse([],[1,2]), [1,2], "First empty" ); - + same( parse([],[1,2]), [1,2], "First empty" ); + // Fixed at [5998], #3641 same( parse([-2,-1], [0,1,2]), [-2,-1,0,1,2], "Second array including a zero (falsy)"); }); @@ -1321,27 +1321,27 @@ test("val()", function() { // ticket #1714 this caused a JS error in IE equals( jQuery("#first").val(), "", "Check a paragraph element to see if it has a value" ); ok( jQuery([]).val() === undefined, "Check an empty jQuery object will return undefined from val" ); - + equals( jQuery('#select2').val(), '3', 'Call val() on a single="single" select' ); isSet( jQuery('#select3').val(), ['1', '2'], 'Call val() on a multiple="multiple" select' ); equals( jQuery('#option3c').val(), '2', 'Call val() on a option element with value' ); - + equals( jQuery('#option3a').val(), '', 'Call val() on a option element with empty value' ); - + equals( jQuery('#option3e').val(), 'no value', 'Call val() on a option element with no value attribute' ); - + }); test("val(String/Number)", function() { expect(6); document.getElementById('text1').value = "bla"; equals( jQuery("#text1").val(), "bla", "Check for modified value of input element" ); - + jQuery("#text1").val('test'); equals( document.getElementById('text1').value, "test", "Check for modified (via val(String)) value of input element" ); - + jQuery("#text1").val(67); equals( document.getElementById('text1').value, "67", "Check for modified (via val(Number)) value of input element" ); @@ -1360,9 +1360,9 @@ test("val(String/Number)", function() { test("html(String)", function() { expect(17); - + jQuery.scriptorder = 0; - + var div = jQuery("#main > div"); div.html("test"); var pass = true; @@ -1443,7 +1443,7 @@ test("not()", function() { isSet( jQuery('#ap *').not('code'), q("google", "groups", "anchor1", "mark"), "not('tag selector')" ); isSet( jQuery('#ap *').not('code, #mark'), q("google", "groups", "anchor1"), "not('tag, ID selector')" ); - isSet( jQuery('#ap *').not('#mark, code'), q("google", "groups", "anchor1"), "not('ID, tag selector')"); + isSet( jQuery('#ap *').not('#mark, code'), q("google", "groups", "anchor1"), "not('ID, tag selector')"); }); test("andSelf()", function() { @@ -1555,22 +1555,22 @@ test("addClass(String)", function() { test("removeClass(String) - simple", function() { expect(4); - + var $divs = jQuery('div'); - + $divs.addClass("test").removeClass("test"); - + ok( !$divs.is('.test'), "Remove Class" ); reset(); - + $divs.addClass("test").addClass("foo").addClass("bar"); $divs.removeClass("test").removeClass("bar").removeClass("foo"); - + ok( !$divs.is('.test,.bar,.foo'), "Remove multiple classes" ); reset(); - + $divs.eq(0).addClass("test").removeClass(""); ok( $divs.eq(0).is('.test'), "Empty string passed to removeClass" ); @@ -1696,16 +1696,16 @@ test("empty()", function() { test("slice()", function() { expect(6); - + var $links = jQuery("#ap a"); - + isSet( $links.slice(1,2), q("groups"), "slice(1,2)" ); isSet( $links.slice(1), q("groups", "anchor1", "mark"), "slice(1)" ); isSet( $links.slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" ); isSet( $links.slice(-1), q("mark"), "slice(-1)" ); isSet( $links.eq(1), q("groups"), "eq(1)" ); - + isSet( $links.eq('2'), q("anchor1"), "eq('2')" ); }); @@ -1816,7 +1816,7 @@ test("jQuery.makeArray", function(){ // function, is tricky as it has length equals( jQuery.makeArray( function(){ return 1;} )[0](), 1, "Pass makeArray a function" ); - + //window, also has length equals( jQuery.makeArray(window)[0], window, "Pass makeArray the window" ); diff --git a/1.3/test/unit/dimensions.js b/1.3/test/unit/dimensions.js index 2e2bb42..75d4bb5 100644 --- a/1.3/test/unit/dimensions.js +++ b/1.3/test/unit/dimensions.js @@ -10,20 +10,20 @@ test("innerWidth()", function() { border: "2px solid #fff", width: 30 }); - + equals($div.innerWidth(), 30, "Test with margin and border"); $div.css("padding", "20px"); equals($div.innerWidth(), 70, "Test with margin, border and padding"); $div.hide(); equals($div.innerWidth(), 70, "Test hidden div"); - + // reset styles $div.css({ display: "", border: "", padding: "", width: "", height: "" }); }); test("innerHeight()", function() { expect(3); - + var $div = jQuery("#nothiddendiv"); // set styles $div.css({ @@ -31,23 +31,23 @@ test("innerHeight()", function() { border: "2px solid #fff", height: 30 }); - + equals($div.innerHeight(), 30, "Test with margin and border"); $div.css("padding", "20px"); equals($div.innerHeight(), 70, "Test with margin, border and padding"); $div.hide(); equals($div.innerHeight(), 70, "Test hidden div"); - + // reset styles $div.css({ display: "", border: "", padding: "", width: "", height: "" }); }); test("outerWidth()", function() { expect(6); - + var $div = jQuery("#nothiddendiv"); $div.css("width", 30); - + equals($div.outerWidth(), 30, "Test with only width set"); $div.css("padding", "20px"); equals($div.outerWidth(), 70, "Test with padding"); @@ -59,17 +59,17 @@ test("outerWidth()", function() { equals($div.outerWidth(true), 94, "Test with padding, border and margin with margin option"); $div.hide(); equals($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option"); - + // reset styles $div.css({ position: "", display: "", border: "", padding: "", width: "", height: "" }); }); test("outerHeight()", function() { expect(6); - + var $div = jQuery("#nothiddendiv"); $div.css("height", 30); - + equals($div.outerHeight(), 30, "Test with only width set"); $div.css("padding", "20px"); equals($div.outerHeight(), 70, "Test with padding"); @@ -80,7 +80,7 @@ test("outerHeight()", function() { equals($div.outerHeight(true), 94, "Test with padding, border and margin with margin option"); $div.hide(); equals($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option"); - + // reset styles $div.css({ display: "", border: "", padding: "", width: "", height: "" }); }); \ No newline at end of file diff --git a/1.3/test/unit/event.js b/1.3/test/unit/event.js index 83a0797..3abf859 100644 --- a/1.3/test/unit/event.js +++ b/1.3/test/unit/event.js @@ -48,7 +48,7 @@ test("bind(), no data", function() { test("bind(), iframes", function() { // events don't work with iframes, see #939 - this test fails in IE because of contentDocument // var doc = document.getElementById("iframe").contentDocument; - // + // // doc.body.innerHTML = ""; // // var input = doc.getElementsByTagName("input")[0]; @@ -114,7 +114,7 @@ test("bind(), namespaced events, cloned events", function() { test("bind(), multi-namespaced events", function() { expect(6); - + var order = [ "click.test.abc", "click.test.abc", @@ -123,7 +123,7 @@ test("bind(), multi-namespaced events", function() { "click.test", "custom.test2" ]; - + function check(name, msg){ same(name, order.shift(), msg); } @@ -168,23 +168,23 @@ test("bind(), multi-namespaced events", function() { test("unbind(type)", function() { expect( 0 ); - + var $elem = jQuery("#firstp"), message; function error(){ ok( false, message ); } - + message = "unbind passing function"; $elem.bind('error', error).unbind('error',error).triggerHandler('error'); - + message = "unbind all from event"; $elem.bind('error', error).unbind('error').triggerHandler('error'); - + message = "unbind all"; $elem.bind('error', error).unbind().triggerHandler('error'); - + message = "unbind many with function"; $elem.bind('error error2',error) .unbind('error error2', error ) @@ -198,7 +198,7 @@ test("unbind(type)", function() { test("unbind(eventObject)", function() { expect(4); - + var $elem = jQuery("#firstp"), num; @@ -207,7 +207,7 @@ test("unbind(eventObject)", function() { $elem.trigger('foo').triggerHandler('bar'); equals( num, expected, "Check the right handlers are triggered" ); } - + $elem // This handler shouldn't be unbound .bind('foo', function(){ @@ -221,14 +221,14 @@ test("unbind(eventObject)", function() { .bind('bar', function(){ num += 4; }); - + assert( 7 ); assert( 5 ); - + $elem.unbind('bar'); assert( 1 ); - - $elem.unbind(); + + $elem.unbind(); assert( 0 ); }); @@ -240,25 +240,25 @@ test("trigger() shortcuts", function() { ok( !close[0], "Context element does not exist, direct access to element must return undefined" ); return false; }).click(); - + jQuery("#check1").click(function() { ok( true, "click event handler for checkbox gets fired twice, see #815" ); }).click(); - + var counter = 0; jQuery('#firstp')[0].onclick = function(event) { counter++; }; jQuery('#firstp').click(); equals( counter, 1, "Check that click, triggers onclick event handler also" ); - + var clickCounter = 0; jQuery('#simon1')[0].onclick = function(event) { clickCounter++; }; jQuery('#simon1').click(); equals( clickCounter, 1, "Check that click, triggers onclick event handler on an a tag also" ); - + jQuery('').load(function(){ ok( true, "Trigger the load event, using the shortcut .load() (#2819)"); }).load(); @@ -340,28 +340,28 @@ test("trigger(type, [data], [fn])", function() { test("trigger(eventObject, [data], [fn])", function() { expect(25); - + var $parent = jQuery('
    ').hide().appendTo('body'), $child = jQuery('

    foo

    ').appendTo( $parent ); - - var event = jQuery.Event("noNew"); + + var event = jQuery.Event("noNew"); ok( event != window, "Instantiate jQuery.Event without the 'new' keyword" ); equals( event.type, "noNew", "Verify its type" ); - + equals( event.isDefaultPrevented(), false, "Verify isDefaultPrevented" ); equals( event.isPropagationStopped(), false, "Verify isPropagationStopped" ); equals( event.isImmediatePropagationStopped(), false, "Verify isImmediatePropagationStopped" ); - + event.preventDefault(); equals( event.isDefaultPrevented(), true, "Verify isDefaultPrevented" ); event.stopPropagation(); equals( event.isPropagationStopped(), true, "Verify isPropagationStopped" ); - + event.isPropagationStopped = function(){ return false }; event.stopImmediatePropagation(); equals( event.isPropagationStopped(), true, "Verify isPropagationStopped" ); equals( event.isImmediatePropagationStopped(), true, "Verify isPropagationStopped" ); - + $parent.bind('foo',function(e){ // Tries bubbling equals( e.type, 'foo', 'Verify event type when passed passing an event object' ); @@ -369,57 +369,57 @@ test("trigger(eventObject, [data], [fn])", function() { equals( e.currentTarget.id, 'par', 'Verify event.target when passed passing an event object' ); equals( e.secret, 'boo!', 'Verify event object\'s custom attribute when passed passing an event object' ); }); - + // test with an event object event = new jQuery.Event("foo"); event.secret = 'boo!'; $child.trigger(event); - + // test with a literal object $child.trigger({type:'foo', secret:'boo!'}); - + $parent.unbind(); function error(){ ok( false, "This assertion shouldn't be reached"); } - + $parent.bind('foo', error ); - + $child.bind('foo',function(e, a, b, c ){ equals( arguments.length, 4, "Check arguments length"); equals( a, 1, "Check first custom argument"); equals( b, 2, "Check second custom argument"); equals( c, 3, "Check third custom argument"); - + equals( e.isDefaultPrevented(), false, "Verify isDefaultPrevented" ); equals( e.isPropagationStopped(), false, "Verify isPropagationStopped" ); equals( e.isImmediatePropagationStopped(), false, "Verify isImmediatePropagationStopped" ); - + // Skips both errors e.stopImmediatePropagation(); - + return "result"; }); - + // We should add this back in when we want to test the order // in which event handlers are iterated. //$child.bind('foo', error ); - + event = new jQuery.Event("foo"); $child.trigger( event, [1,2,3] ).unbind(); equals( event.result, "result", "Check event.result attribute"); - + // Will error if it bubbles $child.triggerHandler('foo'); - + $child.unbind(); $parent.unbind().remove(); }); test("toggle(Function, Function, ...)", function() { expect(11); - + var count = 0, fn1 = function(e) { count++; }, fn2 = function(e) { count--; }, @@ -442,7 +442,7 @@ test("toggle(Function, Function, ...)", function() { }); return false; }).click().click().click(); - + var turn = 0; var fns = [ function(){ @@ -455,7 +455,7 @@ test("toggle(Function, Function, ...)", function() { turn = 3; } ]; - + var $div = jQuery("
     
    ").toggle( fns[0], fns[1], fns[2] ); $div.click(); equals( turn, 1, "Trying toggle with 3 functions, attempt 1 yields 1"); @@ -467,7 +467,7 @@ test("toggle(Function, Function, ...)", function() { equals( turn, 1, "Trying toggle with 3 functions, attempt 4 yields 1"); $div.click(); equals( turn, 2, "Trying toggle with 3 functions, attempt 5 yields 2"); - + $div.unbind('click',fns[0]); var data = jQuery.data( $div[0], 'events' ); ok( !data, "Unbinding one function from toggle unbinds them all"); @@ -588,18 +588,18 @@ test(".live()/.die()", function() { // Cleanup jQuery("#nothiddendiv").die("foo", callback); - + // Make sure we don't loose the target by DOM modifications // after the bubble already reached the liveHandler var livec = 0, elemDiv = jQuery("#nothiddendivchild").html('').get(0); - + jQuery("#nothiddendivchild").live("click", function(e){ jQuery("#nothiddendivchild").html(''); }); jQuery("#nothiddendivchild").live("click", function(e){ if(e.target) {livec++;} }); - + jQuery("#nothiddendiv span").click(); equals( jQuery("#nothiddendiv span").length, 0, "Verify that first handler occurred and modified the DOM." ); equals( livec, 1, "Verify that second handler occurred even with nuked target." ); - + // Cleanup jQuery("#nothiddendivchild").die("click"); }); diff --git a/1.3/test/unit/fx.js b/1.3/test/unit/fx.js index 6de4254..3c6221f 100644 --- a/1.3/test/unit/fx.js +++ b/1.3/test/unit/fx.js @@ -27,7 +27,7 @@ test("animate option (queue === false)", function () { order.push(1); }}); $foo.animate({height:'100px'}, 10, function() { - // queued behind the first animation so should finish third + // queued behind the first animation so should finish third order.push(3); isSet( order, [ 1, 2, 3], "Animations finished in the correct order" ); start(); @@ -157,7 +157,7 @@ test("toggle()", function() { ok( x.is(":hidden"), "is hidden" ); x.toggle(); ok( x.is(":visible"), "is visible again" ); - + x.toggle(true); ok( x.is(":visible"), "is visible" ); x.toggle(false); @@ -187,7 +187,7 @@ test("JS Overflow and Display", function() { .after("text after") .animate({ opacity: 0.5 }, "slow", jQuery.checkOverflowDisplay); }); - + test("CSS Overflow and Display", function() { expect(2); stop(); @@ -259,16 +259,16 @@ jQuery.each( { }, function(tn, t){ test(fn + " to " + tn, function() { var elem = jQuery.makeTest( fn + " to " + tn ); - + var t_w = t( elem, "width" ); var f_w = f( elem, "width" ); var t_h = t( elem, "height" ); var f_h = f( elem, "height" ); var t_o = t( elem, "opacity" ); var f_o = f( elem, "opacity" ); - + var num = 0; - + if ( t_h == "show" ) num++; if ( t_w == "show" ) num++; if ( t_w == "hide"||t_w == "show" ) num++; @@ -278,59 +278,59 @@ jQuery.each( { if ( t_o.constructor == Number ) num += 2; if ( t_w.constructor == Number ) num += 2; if ( t_h.constructor == Number ) num +=2; - + expect(num); stop(); - + var anim = { width: t_w, height: t_h, opacity: t_o }; - + elem.animate(anim, 50, function(){ if ( t_w == "show" ) equals( this.style.display, "block", "Showing, display should block: " + this.style.display); - + if ( t_w == "hide"||t_w == "show" ) equals(this.style.width.indexOf(f_w), 0, "Width must be reset to " + f_w + ": " + this.style.width); - + if ( t_h == "hide"||t_h == "show" ) equals(this.style.height.indexOf(f_h), 0, "Height must be reset to " + f_h + ": " + this.style.height); - + var cur_o = jQuery.attr(this.style, "opacity"); if ( cur_o !== "" ) cur_o = parseFloat( cur_o ); - + if ( t_o == "hide"||t_o == "show" ) equals(cur_o, f_o, "Opacity must be reset to " + f_o + ": " + cur_o); - + if ( t_w == "hide" ) equals(this.style.display, "none", "Hiding, display should be none: " + this.style.display); - + if ( t_o.constructor == Number ) { equals(cur_o, t_o, "Final opacity should be " + t_o + ": " + cur_o); - + ok(jQuery.curCSS(this, "opacity") != "" || cur_o == t_o, "Opacity should be explicitly set to " + t_o + ", is instead: " + cur_o); } - + if ( t_w.constructor == Number ) { equals(this.style.width, t_w + "px", "Final width should be " + t_w + ": " + this.style.width); - + var cur_w = jQuery.css(this,"width"); ok(this.style.width != "" || cur_w == t_w, "Width should be explicitly set to " + t_w + ", is instead: " + cur_w); } - + if ( t_h.constructor == Number ) { equals(this.style.height, t_h + "px", "Final height should be " + t_h + ": " + this.style.height); - + var cur_h = jQuery.css(this,"height"); ok(this.style.height != "" || cur_h == t_h, "Height should be explicitly set to " + t_h + ", is instead: " + cur_w); } - + if ( t_h == "show" ) { var old_h = jQuery.curCSS(this, "height"); jQuery(elem).append("
    Some more text
    and some more..."); ok(old_h != jQuery.css(this, "height" ), "Make sure height is auto."); } - + start(); }); }); @@ -338,9 +338,9 @@ jQuery.each( { }); jQuery.fn.saveState = function(){ - var check = ['opacity','height','width','display','overflow']; + var check = ['opacity','height','width','display','overflow']; expect(check.length); - + stop(); return this.each(function(){ var self = this; diff --git a/1.3/test/unit/offset.js b/1.3/test/unit/offset.js index 096bcb5..18afe6e 100644 --- a/1.3/test/unit/offset.js +++ b/1.3/test/unit/offset.js @@ -9,10 +9,10 @@ var testwin = function(name, fn) { test(name, fn); } }, 0); - + function load_offset_fixture(name) { var win = window.open( "./data/offset/" + name + ".html?num"+parseInt(Math.random()*1000), name, 'left=0,top=0,width=500,height=500,toolbar=1,resizable=0' ); - if ( !win ) { + if ( !win ) { alert("Please disable your popup blocker for the offset test suite"); throw "Please disable your popup blocker for the offset test suite"; } @@ -22,152 +22,152 @@ var testwin = function(name, fn) { testwin("absolute", function() { var $w = testwin["absolute"].$; - + equals( $w('#absolute-1').offset().top, 1, "jQuery('#absolute-1').offset().top" ); equals( $w('#absolute-1').offset().left, 1, "jQuery('#absolute-1').offset().left" ); - + equals( $w('#absolute-1-1').offset().top, 5, "jQuery('#absolute-1-1').offset().top" ); equals( $w('#absolute-1-1').offset().left, 5, "jQuery('#absolute-1-1').offset().left" ); - + equals( $w('#absolute-1-1-1').offset().top, 9, "jQuery('#absolute-1-1-1').offset().top" ); equals( $w('#absolute-1-1-1').offset().left, 9, "jQuery('#absolute-1-1-1').offset().left" ); - + equals( $w('#absolute-2').offset().top, 20, "jQuery('#absolute-2').offset().top" ); equals( $w('#absolute-2').offset().left, 20, "jQuery('#absolute-2').offset().left" ); - - + + equals( $w('#absolute-1').position().top, 0, "jQuery('#absolute-1').position().top" ); equals( $w('#absolute-1').position().left, 0, "jQuery('#absolute-1').position().left" ); - + equals( $w('#absolute-1-1').position().top, 1, "jQuery('#absolute-1-1').position().top" ); equals( $w('#absolute-1-1').position().left, 1, "jQuery('#absolute-1-1').position().left" ); - + equals( $w('#absolute-1-1-1').position().top, 1, "jQuery('#absolute-1-1-1').position().top" ); equals( $w('#absolute-1-1-1').position().left, 1, "jQuery('#absolute-1-1-1').position().left" ); - + equals( $w('#absolute-2').position().top, 19, "jQuery('#absolute-2').position().top" ); equals( $w('#absolute-2').position().left, 19, "jQuery('#absolute-2').position().left" ); - + testwin["absolute"].close(); }); testwin("relative", function() { var $w = testwin["relative"].$; - + // IE is collapsing the top margin of 1px equals( $w('#relative-1').offset().top, jQuery.browser.msie ? 6 : 7, "jQuery('#relative-1').offset().top" ); equals( $w('#relative-1').offset().left, 7, "jQuery('#relative-1').offset().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#relative-1-1').offset().top, jQuery.browser.msie ? 13 : 15, "jQuery('#relative-1-1').offset().top" ); equals( $w('#relative-1-1').offset().left, 15, "jQuery('#relative-1-1').offset().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#relative-2').offset().top, jQuery.browser.msie ? 141 : 142, "jQuery('#relative-2').offset().top" ); equals( $w('#relative-2').offset().left, 27, "jQuery('#relative-2').offset().left" ); - - + + // IE is collapsing the top margin of 1px equals( $w('#relative-1').position().top, jQuery.browser.msie ? 5 : 6, "jQuery('#relative-1').position().top" ); equals( $w('#relative-1').position().left, 6, "jQuery('#relative-1').position().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#relative-1-1').position().top, jQuery.browser.msie ? 4 : 5, "jQuery('#relative-1-1').position().top" ); equals( $w('#relative-1-1').position().left, 5, "jQuery('#relative-1-1').position().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#relative-2').position().top, jQuery.browser.msie ? 140 : 141, "jQuery('#relative-2').position().top" ); equals( $w('#relative-2').position().left, 26, "jQuery('#relative-2').position().left" ); - + testwin["relative"].close(); }); testwin("static", function() { var $w = testwin["static"].$; - + // IE is collapsing the top margin of 1px equals( $w('#static-1').offset().top, jQuery.browser.msie ? 6 : 7, "jQuery('#static-1').offset().top" ); equals( $w('#static-1').offset().left, 7, "jQuery('#static-1').offset().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#static-1-1').offset().top, jQuery.browser.msie ? 13 : 15, "jQuery('#static-1-1').offset().top" ); equals( $w('#static-1-1').offset().left, 15, "jQuery('#static-1-1').offset().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#static-1-1-1').offset().top, jQuery.browser.msie ? 20 : 23, "jQuery('#static-1-1-1').offset().top" ); equals( $w('#static-1-1-1').offset().left, 23, "jQuery('#static-1-1-1').offset().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#static-2').offset().top, jQuery.browser.msie ? 121 : 122, "jQuery('#static-2').offset().top" ); equals( $w('#static-2').offset().left, 7, "jQuery('#static-2').offset().left" ); - - + + // IE is collapsing the top margin of 1px equals( $w('#static-1').position().top, jQuery.browser.msie ? 5 : 6, "jQuery('#static-1').position().top" ); equals( $w('#static-1').position().left, 6, "jQuery('#static-1').position().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#static-1-1').position().top, jQuery.browser.msie ? 12 : 14, "jQuery('#static-1-1').position().top" ); equals( $w('#static-1-1').position().left, 14, "jQuery('#static-1-1').position().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#static-1-1-1').position().top, jQuery.browser.msie ? 19 : 22, "jQuery('#static-1-1-1').position().top" ); equals( $w('#static-1-1-1').position().left, 22, "jQuery('#static-1-1-1').position().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#static-2').position().top, jQuery.browser.msie ? 120 : 121, "jQuery('#static-2').position().top" ); equals( $w('#static-2').position().left, 6, "jQuery('#static-2').position().left" ); - + testwin["static"].close(); }); if ( !jQuery.browser.msie || (jQuery.browser.msie && parseInt(jQuery.browser.version) > 6) ) testwin("fixed", function() { var $w = testwin["fixed"].$; - + equals( $w('#fixed-1').offset().top, 1001, "jQuery('#fixed-1').offset().top" ); equals( $w('#fixed-1').offset().left, 1001, "jQuery('#fixed-1').offset().left" ); - + equals( $w('#fixed-2').offset().top, 1021, "jQuery('#fixed-2').offset().top" ); equals( $w('#fixed-2').offset().left, 1021, "jQuery('#fixed-2').offset().left" ); - + testwin["fixed"].close(); }); testwin("table", function() { var $w = testwin["table"].$; - + equals( $w('#table-1').offset().top, 6, "jQuery('#table-1').offset().top" ); equals( $w('#table-1').offset().left, 6, "jQuery('#table-1').offset().left" ); - + equals( $w('#th-1').offset().top, 10, "jQuery('#table-1').offset().top" ); equals( $w('#th-1').offset().left, 10, "jQuery('#table-1').offset().left" ); - + equals( $w('#th-2').offset().top, 10, "jQuery('#table-1').offset().top" ); equals( $w('#th-2').offset().left, 116, "jQuery('#table-1').offset().left" ); - + testwin["table"].close(); }); testwin("scroll", function() { var $w = testwin["scroll"].$; - + // IE is collapsing the top margin of 1px equals( $w('#scroll-1').offset().top, jQuery.browser.msie ? 6 : 7, "jQuery('#scroll-1').offset().top" ); equals( $w('#scroll-1').offset().left, 7, "jQuery('#scroll-1').offset().left" ); - + // IE is collapsing the top margin of 1px equals( $w('#scroll-1-1').offset().top, jQuery.browser.msie ? 9 : 11, "jQuery('#scroll-1-1').offset().top" ); equals( $w('#scroll-1-1').offset().left, 11, "jQuery('#scroll-1-1').offset().left" ); - + testwin["scroll"].close(); }); testwin("body", function() { var $w = testwin["body"].$; - + equals( $w('body').offset().top, 1, "jQuery('#body').offset().top" ); equals( $w('body').offset().left, 1, "jQuery('#body').offset().left" ); - + testwin["body"].close(); }); \ No newline at end of file diff --git a/1.3/test/unit/selector.js b/1.3/test/unit/selector.js index 638f508..ae2c1a2 100644 --- a/1.3/test/unit/selector.js +++ b/1.3/test/unit/selector.js @@ -15,7 +15,7 @@ test("element", function() { t( "Element Selector", "html", ["html"] ); t( "Parent Element", "div p", ["firstp","ap","sndp","en","sap","first"] ); equals( jQuery("param", "#object1").length, 2, "Object/param as context" ); - + ok( jQuery("#length").length, '<input name="length"> cannot be found under IE, see #945' ); ok( jQuery("#lengthtest input").length, '<input name="length"> cannot be found under IE, see #945' ); }); @@ -41,7 +41,7 @@ test("broken", function() { name + ": " + selector ); } } - + broken( "Broken Selector", "[", [] ); broken( "Broken Selector", "(", [] ); broken( "Broken Selector", "{", [] ); @@ -62,26 +62,26 @@ test("id", function() { t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"] ); t( "Descendant ID selector using UTF8", "div #台北", ["台北"] ); t( "Child ID selector using UTF8", "form > #台北", ["台北"] ); - + t( "Escaped ID", "#foo\\:bar", ["foo:bar"] ); t( "Escaped ID", "#test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); t( "Descendant escaped ID", "div #foo\\:bar", ["foo:bar"] ); t( "Descendant escaped ID", "div #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); t( "Child escaped ID", "form > #foo\\:bar", ["foo:bar"] ); t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); - + t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267 t( "ID Selector, not an ancestor ID", "#form #first", [] ); t( "ID Selector, not a child ID", "#form > #option1a", [] ); - + t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] ); t( "All Children of ID with no children", "#firstUL > *", [] ); - + jQuery('tName1 AtName2 A
    tName1 Div
    ').appendTo('#main'); equals( jQuery("#tName1")[0].id, 'tName1', "ID selector with same value for a name attribute" ); equals( jQuery("#tName2").length, 0, "ID selector non-existing but name attribute on an A tag" ); t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] ); - + t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986 isSet( jQuery("body").find("div#form"), [], "ID selector within the context of another element" ); @@ -93,14 +93,14 @@ test("class", function() { t( "Class Selector", ".blog.link", ["simon"] ); t( "Class Selector w/ Element", "a.blog", ["mark","simon"] ); t( "Parent Class Selector", "p .blog", ["mark","simon"] ); - + t( "Class selector using UTF8", ".台北Táiběi", ["utf8class1"] ); //t( "Class selector using UTF8", ".台北", ["utf8class1","utf8class2"] ); t( "Class selector using UTF8", ".台北Táiběi.台北", ["utf8class1"] ); t( "Class selector using UTF8", ".台北Táiběi, .台北", ["utf8class1","utf8class2"] ); t( "Descendant class selector using UTF8", "div .台北Táiběi", ["utf8class1"] ); t( "Child class selector using UTF8", "form > .台北Táiběi", ["utf8class1"] ); - + t( "Escaped Class", ".foo\\:bar", ["foo:bar"] ); t( "Escaped Class", ".test\\.foo\\[5\\]bar", ["test.foo[5]bar"] ); t( "Descendant scaped Class", "div .foo\\:bar", ["foo:bar"] ); @@ -127,13 +127,13 @@ test("name", function() { test("multiple", function() { expect(4); - + var results = ["mark","simon","firstp","ap","sndp","en","sap","first"]; - + if ( document.querySelectorAll ) { results = ["firstp","ap","mark","sndp","en","sap","simon","first"]; } - + t( "Comma Support", "a.blog, p", results); t( "Comma Support", "a.blog , p", results); t( "Comma Support", "a.blog ,p", results); @@ -161,13 +161,13 @@ test("child and adjacent", function() { isSet( jQuery("> *:first", document.getElementById("nothiddendiv")), q("nothiddendivchild"), "Verify child context positional selctor" ); t( "Non-existant ancestors", ".fototab > .thumbnails > a", [] ); - + t( "First Child", "p:first-child", ["firstp","sndp"] ); t( "Nth Child", "p:nth-child(1)", ["firstp","sndp"] ); - + t( "Last Child", "p:last-child", ["sap"] ); t( "Last Child", "a:last-child", ["simon1","anchor1","mark","yahoo","anchor2","simon"] ); - + t( "Nth-child", "#main form#form > *:nth-child(2)", ["text1"] ); t( "Nth-child", "#main form#form > :nth-child(2)", ["text1"] ); @@ -197,7 +197,7 @@ test("attributes", function() { t( "Attribute Exists", "*[title]", ["google"] ); t( "Attribute Exists", "[title]", ["google"] ); t( "Attribute Exists", "a[ title ]", ["google"] ); - + t( "Attribute Equals", "a[rel='bookmark']", ["simon1"] ); t( "Attribute Equals", 'a[rel="bookmark"]', ["simon1"] ); t( "Attribute Equals", "a[rel=bookmark]", ["simon1"] ); @@ -210,29 +210,29 @@ test("attributes", function() { t( "for Attribute", "form label[for]", ["label-for"] ); t( "for Attribute in form", "#form [for=action]", ["label-for"] ); - + var results = ["hidden1","radio1","radio2"]; - + if ( document.querySelectorAll ) { results = ["radio1", "radio2", "hidden1"]; } - + t( "Multiple Attribute Equals", "#form input[type='hidden'],#form input[type='radio']", results ); t( "Multiple Attribute Equals", "#form input[type=\"hidden\"],#form input[type='radio']", results ); t( "Multiple Attribute Equals", "#form input[type=hidden],#form input[type=radio]", results ); - + t( "Attribute selector using UTF8", "span[lang=中文]", ["台北"] ); - + t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] ); t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] ); t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] ); - + t("Select options via :selected", "#select1 option:selected", ["option1a"] ); t("Select options via :selected", "#select2 option:selected", ["option2d"] ); t("Select options via :selected", "#select3 option:selected", ["option3b", "option3c"] ); - + t( "Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"] ); - + t( ":not() Existing attribute", "#form select:not([multiple])", ["select1", "select2"]); t( ":not() Equals attribute", "#form select:not([name=select1])", ["select2", "select3"]); t( ":not() Equals quoted attribute", "#form select:not([name='select1'])", ["select2", "select3"]); @@ -255,7 +255,7 @@ test("pseudo (:) selectors", function() { t( "Not - multiple", "#form option:not(:contains('Nothing'),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d", "option3e"] ); //t( "Not - complex", "#form option:not([id^='opt']:nth-child(-n+3))", [ "option1a", "option1d", "option2d", "option3d", "option3e"] ); t( "Not - recursive", "#form option:not(:not(:selected))[id^='option3']", [ "option3b", "option3c"] ); - + t( "nth Element", "p:nth(1)", ["ap"] ); t( "First Element", "p:first", ["firstp"] ); t( "Last Element", "p:last", ["first"] ); @@ -267,7 +267,7 @@ test("pseudo (:) selectors", function() { t( "Is A Parent", "p:parent", ["firstp","ap","sndp","en","sap","first"] ); t( "Is Visible", "#form input:visible", ["text1","text2","radio1","radio2","check1","check2","name"] ); t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] ); - + t( "Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "button", "area1", "select1", "select2", "select3"] ); t( "Form element :radio", "#form :radio", ["radio1", "radio2"] ); t( "Form element :checkbox", "#form :checkbox", ["check1", "check2"] ); diff --git a/jquery_ui_full/jquery-ui-personalized-1.6rc5.js b/jquery_ui_full/jquery-ui-personalized-1.6rc5.js index 75ed067..991780e 100755 --- a/jquery_ui_full/jquery-ui-personalized-1.6rc5.js +++ b/jquery_ui_full/jquery-ui-personalized-1.6rc5.js @@ -464,7 +464,7 @@ $.ui.mouse = { // however, in Safari, this causes select boxes not to be selectable // anymore, so this fix is needed ($.browser.safari || event.preventDefault()); - + return true; }, @@ -674,7 +674,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { var dropped = false; if ($.ui.ddmanager && !this.options.dropBehaviour) dropped = $.ui.ddmanager.drop(this, event); - + //if a drop comes from outside (a sortable) if(this.dropped) { dropped = this.dropped; @@ -736,7 +736,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { //Get the offsetParent and cache its position this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); - + // This is a special case where we need to modify a offset calculated on start, since the following happened: // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that @@ -831,7 +831,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { - ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod ) }; - + }, _generatePosition: function(event) { @@ -845,7 +845,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset(); } - + var pageX = event.pageX; var pageY = event.pageY; @@ -853,7 +853,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { * - Position constraining - * Constrain the position to a mix of grid, containment. */ - + if(this.originalPosition) { //If we are not dragging yet, we won't check for options if(this.containment) { @@ -862,7 +862,7 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, { if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; } - + if(o.grid) { var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; @@ -985,15 +985,15 @@ $.ui.plugin.add("draggable", "connectToSortable", { $.each(inst.sortables, function() { if(this.instance.isOver) { - + this.instance.isOver = 0; - + inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) - + //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' if(this.shouldRevert) this.instance.options.revert = true; - + //Trigger the stop of the sortable this.instance._mouseStop(event); @@ -2103,7 +2103,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, { _propagate: function(n, event) { $.ui.plugin.call(this, n, [event, this.ui()]); - + (n != "resize" && this._trigger(n, event, this.ui())); }, @@ -3237,11 +3237,11 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { return el; }, update: function(container, p) { - + // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified if(className && !o.forcePlaceholderSize) return; - + //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); }; if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); }; @@ -3335,7 +3335,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { //Get the offsetParent and cache its position this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); - + // This is a special case where we need to modify a offset calculated on start, since the following happened: // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that @@ -3430,7 +3430,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { - ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod ) }; - + }, _generatePosition: function(event) { @@ -3444,7 +3444,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset(); } - + var pageX = event.pageX; var pageY = event.pageY; @@ -3452,7 +3452,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { * - Position constraining - * Constrain the position to a mix of grid, containment. */ - + if(this.originalPosition) { //If we are not dragging yet, we won't check for options if(this.containment) { @@ -3461,7 +3461,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; } - + if(o.grid) { var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; @@ -3488,7 +3488,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) }; - + }, _rearrange: function(event, i, a, hardRefresh) { @@ -4781,7 +4781,7 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { this.range = $([]); if (o.range) { - + if (o.range === true) { this.range = $('
    '); if (!o.values) o.values = [this._valueMin(), this._valueMin()]; @@ -4801,7 +4801,7 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { (o.range == "max") && (this.orientation == "horizontal") && this.range.css({ right : 0 }); (o.range == "min") && (this.orientation == "vertical") && this.range.css({ bottom : 0 }); (o.range == "max") && (this.orientation == "vertical") && this.range.css({ top : 0 }); - + } if ($(".ui-slider-handle", this.element).length == 0) @@ -4960,25 +4960,25 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { }, _mouseDrag: function(event) { - + var position = { x: event.pageX, y: event.pageY }; var normValue = this._normValueFromMouse(position); this._slide(event, this._handleIndex, normValue); return false; - + }, _mouseStop: function(event) { - + this.handles.removeClass("ui-state-active"); this._stop(event); this._change(event); this._handleIndex = null; return false; - + }, _normValueFromMouse: function(position) { @@ -5007,7 +5007,7 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { normValue += this.options.step; return normValue; - + }, _start: function(event) { @@ -5017,7 +5017,7 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, { }, _slide: function(event, index, newVal) { - + if (this.options.values && this.options.values.length) { var handle = this.handles[index]; @@ -5381,11 +5381,11 @@ $.widget("ui.tabs", { // just trigger show event else onShow(); } - + // states var handleState = function(state, el) { if (el.is(':not(.' + o.disabledClass + ')')) el.toggleClass('ui-state-' + state); - }; + }; this.$lis.bind('mouseover.tabs mouseout.tabs', function() { handleState('hover', $(this)); }); @@ -5546,7 +5546,7 @@ $.widget("ui.tabs", { return false; }); - + // disable click if event is configured to something else if (o.event != 'click') this.$tabs.bind('click.tabs', function(){return false;}); @@ -6419,26 +6419,26 @@ $.extend(Datepicker.prototype, { if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst) $(inst.input[0]).focus(); }, - + /* Check positioning to remain on screen. */ - _checkOffset: function(inst, offset, isFixed) { + _checkOffset: function(inst, offset, isFixed) { var dpWidth = inst.dpDiv.outerWidth(); var dpHeight = inst.dpDiv.outerHeight(); var inputWidth = inst.input ? inst.input.outerWidth() : 0; var inputHeight = inst.input ? inst.input.outerHeight() : 0; var viewWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var viewHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; - + offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; - + // now check if datepicker is showing outside window viewpoint - move to a better place if so. offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0; offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0; - + return offset; - }, + }, /* Find an object's position on the screen. */ _findPos: function(obj) { @@ -7555,26 +7555,26 @@ $.effects = $.effects || {}; //Add the 'effects' scope $.extend($.effects, { version: "1.6rc5", - + // Saves a set of properties in a data storage save: function(element, set) { for(var i=0; i < set.length; i++) { if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]); } }, - + // Restores a set of previously saved properties from a data storage restore: function(element, set) { for(var i=0; i < set.length; i++) { if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i])); } }, - + setMode: function(el, mode) { if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle return mode; }, - + getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value // this should be a little more flexible in the future to handle a string & hash var y, x; @@ -7592,7 +7592,7 @@ $.extend($.effects, { }; return {x: x, y: y}; }, - + // Wraps the element around a wrapper that copies position properties createWrapper: function(element) { @@ -7676,7 +7676,7 @@ $.extend($.effects, { //Extend the methods of jQuery $.fn.extend({ - + //Save old methods _show: $.fn.show, _hide: $.fn.hide, @@ -7684,12 +7684,12 @@ $.fn.extend({ _addClass: $.fn.addClass, _removeClass: $.fn.removeClass, _toggleClass: $.fn.toggleClass, - + // New effect methods effect: function(fx, options, speed, callback) { return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null; }, - + show: function() { if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) return this._show.apply(this, arguments); @@ -7698,7 +7698,7 @@ $.fn.extend({ return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]); } }, - + hide: function() { if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0]))) return this._hide.apply(this, arguments); @@ -7707,7 +7707,7 @@ $.fn.extend({ return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]); } }, - + toggle: function(){ if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) || (arguments[0].constructor == Function)) return this.__toggle.apply(this, arguments); @@ -7716,7 +7716,7 @@ $.fn.extend({ return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]); } }, - + addClass: function(classNames, speed, easing, callback) { return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); }, @@ -7732,7 +7732,7 @@ $.fn.extend({ switchClass: function() { return this.morph.apply(this, arguments); }, - + // helper functions cssUnit: function(key) { var style = this.css(key), val = []; @@ -8515,7 +8515,7 @@ $.effects.pulsate = function(o) { var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode var times = o.options.times || 5; // Default # of times var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; - + // Adjust if (mode == 'hide') times--; if (el.is(':hidden')) { // Show fadeIn