From ac8e75b2a665ca87abc32a6aed473af213350625 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 11 Mar 2010 02:29:18 +0000 Subject: [PATCH] ENHANCEMENT Updated jquery.metadata from ~v.1.0 to v2.1 (located in sapphire/thirdparty/jquery-metadata git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100846 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- thirdparty/jquery-metadata/META.json | 0 thirdparty/jquery-metadata/README | 0 thirdparty/jquery-metadata/jquery.metadata.js | 126 +- .../jquery-metadata/jquery.metadata.min.js | 13 - .../jquery-metadata/jquery.metadata.pack.js | 13 - thirdparty/jquery-metadata/test/index.html | 76 +- thirdparty/jquery-metadata/test/jquery.js | 1042 +++++++---------- thirdparty/jquery-metadata/test/test.js | 104 +- thirdparty/jquery-metadata/test/testrunner.js | 0 thirdparty/jquery-metadata/test/testsuite.css | 0 10 files changed, 587 insertions(+), 787 deletions(-) mode change 100644 => 100755 thirdparty/jquery-metadata/META.json mode change 100644 => 100755 thirdparty/jquery-metadata/README mode change 100644 => 100755 thirdparty/jquery-metadata/jquery.metadata.js delete mode 100644 thirdparty/jquery-metadata/jquery.metadata.min.js delete mode 100644 thirdparty/jquery-metadata/jquery.metadata.pack.js mode change 100644 => 100755 thirdparty/jquery-metadata/test/index.html mode change 100644 => 100755 thirdparty/jquery-metadata/test/jquery.js mode change 100644 => 100755 thirdparty/jquery-metadata/test/test.js mode change 100644 => 100755 thirdparty/jquery-metadata/test/testrunner.js mode change 100644 => 100755 thirdparty/jquery-metadata/test/testsuite.css diff --git a/thirdparty/jquery-metadata/META.json b/thirdparty/jquery-metadata/META.json old mode 100644 new mode 100755 diff --git a/thirdparty/jquery-metadata/README b/thirdparty/jquery-metadata/README old mode 100644 new mode 100755 diff --git a/thirdparty/jquery-metadata/jquery.metadata.js b/thirdparty/jquery-metadata/jquery.metadata.js old mode 100644 new mode 100755 index ad8bfba40..9da403fde --- a/thirdparty/jquery-metadata/jquery.metadata.js +++ b/thirdparty/jquery-metadata/jquery.metadata.js @@ -7,7 +7,7 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * - * Revision: $Id: jquery.metadata.js 4187 2007-12-16 17:15:27Z joern.zaefferer $ + * Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $ * */ @@ -15,7 +15,7 @@ * Sets the type of metadata to use. Metadata is encoded in JSON, and each property * in the JSON will become a property of the element itself. * - * There are three supported types of metadata storage: + * There are four supported types of metadata storage: * * attr: Inside an attribute. The name parameter indicates *which* attribute. * @@ -23,6 +23,7 @@ * * elem: Inside a child element (e.g. a script tag). The * name parameter indicates *which* element. + * html5: Values are stored in data-* attributes. * * The metadata for an element is loaded the first time the element is accessed via jQuery. * @@ -46,6 +47,11 @@ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" * @desc Reads metadata from a nested script element * + * @example

This is a p

+ * @before $.metadata.setType("html5") + * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label" + * @desc Reads metadata from a series of data-* attributes + * * @param String type The encoding type * @param String name The name of the attribute to be used to get metadata (optional) * @cat Plugins/Metadata @@ -57,53 +63,73 @@ (function($) { $.extend({ - metadata : { - defaults : { - type: 'class', - name: 'metadata', - cre: /({.*})/, - single: 'metadata' - }, - setType: function( type, name ){ - this.defaults.type = type; - this.defaults.name = name; - }, - get: function( elem, opts ){ - var settings = $.extend({},this.defaults,opts); - // check for empty string in single property - if ( !settings.single.length ) settings.single = 'metadata'; - - var data = $.data(elem, settings.single); - // returned cached data if it already exists - if ( data ) return data; - - data = "{}"; - - if ( settings.type == "class" ) { - var m = settings.cre.exec( elem.className ); - if ( m ) - data = m[1]; - } else if ( settings.type == "elem" ) { - if( !elem.getElementsByTagName ) - return undefined; - var e = elem.getElementsByTagName(settings.name); - if ( e.length ) - data = $.trim(e[0].innerHTML); - } else if ( elem.getAttribute != undefined ) { - var attr = elem.getAttribute( settings.name ); - if ( attr ) - data = attr; - } - - if ( data.indexOf( '{' ) <0 ) - data = "{" + data + "}"; - - data = eval("(" + data + ")"); - - $.data( elem, settings.single, data ); - return data; - } - } + metadata : { + defaults : { + type: 'class', + name: 'metadata', + cre: /({.*})/, + single: 'metadata' + }, + setType: function( type, name ){ + this.defaults.type = type; + this.defaults.name = name; + }, + get: function( elem, opts ){ + var settings = $.extend({},this.defaults,opts); + // check for empty string in single property + if ( !settings.single.length ) settings.single = 'metadata'; + + var data = $.data(elem, settings.single); + // returned cached data if it already exists + if ( data ) return data; + + data = "{}"; + + var getData = function(data) { + if(typeof data != "string") return data; + + if( data.indexOf('{') < 0 ) { + data = eval("(" + data + ")"); + } + } + + var getObject = function(data) { + if(typeof data != "string") return data; + + data = eval("(" + data + ")"); + return data; + } + + if ( settings.type == "html5" ) { + var object = {}; + $( elem.attributes ).each(function() { + var name = this.nodeName; + if(name.match(/^data-/)) name = name.replace(/^data-/, ''); + else return true; + object[name] = getObject(this.nodeValue); + }); + } else { + if ( settings.type == "class" ) { + var m = settings.cre.exec( elem.className ); + if ( m ) + data = m[1]; + } else if ( settings.type == "elem" ) { + if( !elem.getElementsByTagName ) return; + var e = elem.getElementsByTagName(settings.name); + if ( e.length ) + data = $.trim(e[0].innerHTML); + } else if ( elem.getAttribute != undefined ) { + var attr = elem.getAttribute( settings.name ); + if ( attr ) + data = attr; + } + object = getObject(data.indexOf("{") < 0 ? "{" + data + "}" : data); + } + + $.data( elem, settings.single, object ); + return object; + } + } }); /** @@ -116,7 +142,7 @@ $.extend({ * @cat Plugins/Metadata */ $.fn.metadata = function( opts ){ - return $.metadata.get( this[0], opts ); + return $.metadata.get( this[0], opts ); }; })(jQuery); \ No newline at end of file diff --git a/thirdparty/jquery-metadata/jquery.metadata.min.js b/thirdparty/jquery-metadata/jquery.metadata.min.js deleted file mode 100644 index 1490a7e64..000000000 --- a/thirdparty/jquery-metadata/jquery.metadata.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Metadata - jQuery plugin for parsing metadata from elements - * - * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id: jquery.metadata.js 3620 2007-10-10 20:55:38Z pmclanahan $ - * - */ -(function($){$.extend({metadata:{defaults:{type:'class',name:'metadata',cre:/({.*})/,single:'metadata'},setType:function(type,name){this.defaults.type=type;this.defaults.name=name;},get:function(elem,opts){var settings=$.extend({},this.defaults,opts);if(!settings.single.length)settings.single='metadata';var data=$.data(elem,settings.single);if(data)return data;data="{}";if(settings.type=="class"){var m=settings.cre.exec(elem.className);if(m)data=m[1];}else if(settings.type=="elem"){if(!elem.getElementsByTagName)return;var e=elem.getElementsByTagName(settings.name);if(e.length)data=$.trim(e[0].innerHTML);}else if(elem.getAttribute!=undefined){var attr=elem.getAttribute(settings.name);if(attr)data=attr;}if(data.indexOf('{')<0)data="{"+data+"}";data=eval("("+data+")");$.data(elem,settings.single,data);return data;}}});$.fn.metadata=function(opts){return $.metadata.get(this[0],opts);};})(jQuery); \ No newline at end of file diff --git a/thirdparty/jquery-metadata/jquery.metadata.pack.js b/thirdparty/jquery-metadata/jquery.metadata.pack.js deleted file mode 100644 index 2a3acabce..000000000 --- a/thirdparty/jquery-metadata/jquery.metadata.pack.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Metadata - jQuery plugin for parsing metadata from elements - * - * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id: jquery.metadata.js 3620 2007-10-10 20:55:38Z pmclanahan $ - * - */ -eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(9($){$.r({3:{7:{8:\'l\',h:\'3\',q:/({.*})/,4:\'3\'},w:9(a,b){g.7.8=a;g.7.h=b},j:9(b,c){5 d=$.r({},g.7,c);2(!d.4.o)d.4=\'3\';5 a=$.n(b,d.4);2(a)6 a;a="{}";2(d.8=="l"){5 m=d.q.v(b.u);2(m)a=m[1]}k 2(d.8=="t"){2(!b.i)6;5 e=b.i(d.h);2(e.o)a=$.s(e[0].C)}k 2(b.p!=A){5 f=b.p(d.h);2(f)a=f}2(a.z(\'{\')<0)a="{"+a+"}";a=y("("+a+")");$.n(b,d.4,a);6 a}}});$.x.3=9(a){6 $.3.j(g[0],a)}})(B);',39,39,'||if|metadata|single|var|return|defaults|type|function|||||||this|name|getElementsByTagName|get|else|class||data|length|getAttribute|cre|extend|trim|elem|className|exec|setType|fn|eval|indexOf|undefined|jQuery|innerHTML'.split('|'),0,{})) \ No newline at end of file diff --git a/thirdparty/jquery-metadata/test/index.html b/thirdparty/jquery-metadata/test/index.html old mode 100644 new mode 100755 index 1312baf71..d285ffb41 --- a/thirdparty/jquery-metadata/test/index.html +++ b/thirdparty/jquery-metadata/test/index.html @@ -6,47 +6,53 @@ -

jQuery - Metadata Test Suite

    diff --git a/thirdparty/jquery-metadata/test/jquery.js b/thirdparty/jquery-metadata/test/jquery.js old mode 100644 new mode 100755 index b660baab4..4705dc265 --- a/thirdparty/jquery-metadata/test/jquery.js +++ b/thirdparty/jquery-metadata/test/jquery.js @@ -1,27 +1,29 @@ (function(){ /* - * jQuery 1.2.2b2 - New Wave Javascript + * jQuery @VERSION - New Wave Javascript * * Copyright (c) 2007 John Resig (jquery.com) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * - * $Date: 2007-12-20 14:36:56 +0100 (Don, 20 Dez 2007) $ - * $Rev: 4251 $ + * $Date: 2007-10-01 22:15:20 +0200 (Mo, 01 Okt 2007) $ + * $Rev: 3501 $ */ // Map over jQuery in case of overwrite -if ( window.jQuery ) - var _jQuery = window.jQuery; +if ( typeof jQuery != "undefined" ) + var _jQuery = jQuery; var jQuery = window.jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.prototype.init( selector, context ); + // If the context is a namespace object, return a new object + return this instanceof jQuery ? + this.init( selector, context ) : + new jQuery( selector, context ); }; // Map over the $ in case of overwrite -if ( window.$ ) - var _$ = window.$; +if ( typeof $ != "undefined" ) + var _$ = $; // Map the jQuery namespace to the '$' one window.$ = jQuery; @@ -30,22 +32,13 @@ window.$ = jQuery; // (both of which we optimize for) var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; -// Is it a simple selector -var isSimple = /^.[^:#\[\.]*$/; - jQuery.fn = jQuery.prototype = { init: function( selector, context ) { // Make sure that a selection was provided selector = selector || document; - // Handle $(DOMElement) - if ( selector.nodeType ) { - this[0] = selector; - this.length = 1; - return this; - // Handle HTML strings - } else if ( typeof selector == "string" ) { + if ( typeof selector == "string" ) { // Are we dealing with HTML string or an ID? var match = quickExpr.exec( selector ); @@ -196,15 +189,12 @@ jQuery.fn = jQuery.prototype = { }, css: function( key, value ) { - // ignore negative width and height values - if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) - value = undefined; return this.attr( key, value, "curCSS" ); }, text: function( text ) { if ( typeof text != "object" && text != null ) - return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); + return this.empty().append( document.createTextNode( text ) ); var ret = ""; @@ -253,15 +243,13 @@ jQuery.fn = jQuery.prototype = { append: function() { return this.domManip(arguments, true, false, function(elem){ - if (this.nodeType == 1) - this.appendChild( elem ); + this.appendChild( elem ); }); }, prepend: function() { return this.domManip(arguments, true, true, function(elem){ - if (this.nodeType == 1) - this.insertBefore( elem, this.firstChild ); + this.insertBefore( elem, this.firstChild ); }); }, @@ -294,23 +282,9 @@ jQuery.fn = jQuery.prototype = { clone: function( events ) { // Do the clone var ret = this.map(function(){ - if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { - // IE copies events bound via attachEvent when - // 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 - // as properties will not be copied (such as the - // the name attribute on an input). - var clone = this.cloneNode(true), - container = document.createElement("div"), - container2 = document.createElement("div"); - container.appendChild(clone); - container2.innerHTML = container.innerHTML; - return container2.firstChild; - } else - return this.cloneNode(true); + return this.outerHTML ? + jQuery( this.outerHTML )[0] : + this.cloneNode( true ); }); // Need to set the expando to null on the cloned set if it exists @@ -346,26 +320,19 @@ jQuery.fn = jQuery.prototype = { }, not: function( selector ) { - if ( selector.constructor == String ) - // test special case where just one selector is passed in - if ( isSimple.test( selector ) ) - return this.pushStack( jQuery.multiFilter( selector, this, true ) ); - else - selector = jQuery.multiFilter( selector, this ); + return this.pushStack( + selector.constructor == String && + jQuery.multiFilter( selector, this, true ) || - var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; - return this.filter(function() { - return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; - }); + jQuery.grep(this, function(elem) { + return selector.constructor == Array || selector.jquery ? + jQuery.inArray( elem, selector ) < 0 : + elem != selector; + }) ); }, add: function( selector ) { - return !selector ? this : this.pushStack( jQuery.merge( - this.get(), - selector.constructor == String ? - jQuery( selector ).get() : - selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? - selector : [selector] ) ); + return this.pushStack( jQuery.merge( this.get(), jQuery( selector ) ) ); }, is: function( selector ) { @@ -383,7 +350,7 @@ jQuery.fn = jQuery.prototype = { if ( this.length ) { var elem = this[0]; - + // We need to handle select boxes special if ( jQuery.nodeName( elem, "select" ) ) { var index = elem.selectedIndex, @@ -416,37 +383,32 @@ jQuery.fn = jQuery.prototype = { // Everything else, we just grab the value } else - return (this[0].value || "").replace(/\r/g, ""); + return this[0].value.replace(/\r/g, ""); } - return undefined; - } + } else + return this.each(function(){ + if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) + this.checked = (jQuery.inArray(this.value, value) >= 0 || + jQuery.inArray(this.name, value) >= 0); - return this.each(function(){ - if ( this.nodeType != 1 ) - return; + else if ( jQuery.nodeName( this, "select" ) ) { + var values = value.constructor == Array ? + value : + [ value ]; - if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) - this.checked = (jQuery.inArray(this.value, value) >= 0 || - jQuery.inArray(this.name, value) >= 0); + jQuery( "option", this ).each(function(){ + this.selected = (jQuery.inArray( this.value, values ) >= 0 || + jQuery.inArray( this.text, values ) >= 0); + }); - else if ( jQuery.nodeName( this, "select" ) ) { - var values = value.constructor == Array ? - value : - [ value ]; + if ( !tmp.length ) + this.selectedIndex = -1; - jQuery( "option", this ).each(function(){ - this.selected = (jQuery.inArray( this.value, values ) >= 0 || - jQuery.inArray( this.text, values ) >= 0); - }); - - if ( !values.length ) - this.selectedIndex = -1; - - } else - this.value = value; - }); + } else + this.value = value; + }); }, html: function( value ) { @@ -493,49 +455,41 @@ jQuery.fn = jQuery.prototype = { var obj = this; if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) - obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); - - var scripts = jQuery( [] ); + obj = this.getElementsByTagName("tbody")[0] || this.appendChild( document.createElement("tbody") ); jQuery.each(elems, function(){ var elem = clone ? - jQuery( this ).clone( true )[0] : + this.cloneNode( true ) : this; - // execute all scripts after the elements have been injected - if ( jQuery.nodeName( elem, "script" ) ) { - scripts = scripts.add( elem ); - } else { - // Remove any inner scripts for later evaluation - if ( elem.nodeType == 1 ) - scripts = scripts.add( jQuery( "script", elem ).remove() ); - - // Inject the elements into the document + if ( !evalScript( 0, elem ) ) callback.call( obj, elem ); - } }); - - scripts.each( evalScript ); }); } }; -// Give the init function the jQuery prototype for later instantiation -jQuery.prototype.init.prototype = jQuery.prototype; - function evalScript( i, elem ) { - if ( elem.src ) - jQuery.ajax({ - url: elem.src, - async: false, - dataType: "script" - }); + var script = jQuery.nodeName( elem, "script" ); - else - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + if ( script ) { + if ( elem.src ) + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); - if ( elem.parentNode ) - elem.parentNode.removeChild( elem ); + else + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + + if ( elem.parentNode ) + elem.parentNode.removeChild( elem ); + + } else if ( elem.nodeType == 1 ) + jQuery( "script", elem ).each( evalScript ); + + return script; } jQuery.extend = jQuery.fn.extend = function() { @@ -546,14 +500,8 @@ jQuery.extend = jQuery.fn.extend = function() { if ( target.constructor == Boolean ) { deep = target; target = arguments[1] || {}; - // skip the boolean and the target - i = 2; } - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target != "object" && typeof target != "function" ) - target = {}; - // extend jQuery itself if only one argument is passed if ( length == 1 ) { target = this; @@ -566,12 +514,12 @@ jQuery.extend = jQuery.fn.extend = function() { // Extend the base object for ( var name in options ) { // Prevent never-ending loop - if ( target === options[ name ] ) + if ( target == options[ name ] ) continue; // Recurse if we're merging object values - if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType ) - target[ name ] = jQuery.extend( target[ name ], options[ name ] ); + if ( deep && typeof options[ name ] == "object" && target[ name ] ) + jQuery.extend( target[ name ], options[ name ] ); // Don't bring in undefined values else if ( options[ name ] != undefined ) @@ -612,6 +560,7 @@ jQuery.extend({ }, // Evalulates a script in a global context + // Evaluates Async. in Safari 2 :-( globalEval: function( data ) { data = jQuery.trim( data ); @@ -743,19 +692,18 @@ jQuery.extend({ // internal only, use addClass("class") add: function( elem, classNames ) { jQuery.each((classNames || "").split(/\s+/), function(i, className){ - if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) + if ( !jQuery.className.has( elem.className, className ) ) elem.className += (elem.className ? " " : "") + className; }); }, // internal only, use removeClass("class") remove: function( elem, classNames ) { - if (elem.nodeType == 1) - elem.className = classNames != undefined ? - jQuery.grep(elem.className.split(/\s+/), function(className){ - return !jQuery.className.has( classNames, className ); - }).join(" ") : - ""; + elem.className = classNames != undefined ? + jQuery.grep(elem.className.split(/\s+/), function(className){ + return !jQuery.className.has( classNames, className ); + }).join(" ") : + ""; }, // internal only, use is(".class") @@ -766,10 +714,9 @@ jQuery.extend({ // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { - var old = {}; // Remember the old values, and insert the new ones for ( var name in options ) { - old[ name ] = elem.style[ name ]; + elem.style[ "old" + name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } @@ -777,32 +724,60 @@ jQuery.extend({ // Revert the old values for ( var name in options ) - elem.style[ name ] = old[ name ]; + elem.style[ name ] = elem.style[ "old" + name ]; }, - 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; - jQuery.each( which, function() { - padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; - border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; - }); - val -= Math.round(padding + border); - } - - if ( jQuery(elem).is(":visible") ) - getWH(); - else - jQuery.swap( elem, props, getWH ); - - return Math.max(0, val); + css: function( elem, name ) { + if ( name == "height" || name == "width" ) { + var old = {}, height, width; + + // Revert the padding and border widths to get the + // correct height/width values + jQuery.each([ "Top", "Bottom", "Right", "Left" ], function(){ + old[ "padding" + this ] = 0; + old[ "border" + this + "Width" ] = 0; + }); + + // Swap out the padding/border values temporarily + jQuery.swap( elem, old, function() { + + // If the element is visible, then the calculation is easy + if ( jQuery( elem ).is(":visible") ) { + height = elem.offsetHeight; + width = elem.offsetWidth; + + // Otherwise, we need to flip out more values + } else { + elem = jQuery( elem.cloneNode(true) ) + .find(":radio").removeAttr("checked").end() + .css({ + visibility: "hidden", + position: "absolute", + display: "block", + right: "0", + left: "0" + }).appendTo( elem.parentNode )[0]; + + var position = jQuery.css( elem.parentNode, "position" ) || "static"; + if ( position == "static" ) + elem.parentNode.style.position = "relative"; + + height = elem.clientHeight; + width = elem.clientWidth; + + if ( position == "static" ) + elem.parentNode.style.position = "static"; + + elem.parentNode.removeChild( elem ); + } + }); + + return name == "height" ? + height : + width; } - - return jQuery.curCSS( elem, name, force ); + + return jQuery.curCSS( elem, name ); }, curCSS: function( elem, name, force ) { @@ -825,12 +800,6 @@ jQuery.extend({ "1" : ret; } - // Opera sometimes will give the wrong display answer, this fixes it, see #2037 - if ( jQuery.browser.opera && name == "display" ) { - var save = elem.style.display; - elem.style.display = "block"; - elem.style.display = save; - } // Make sure we're using the right name for getting the float value if ( name.match( /float/i ) ) @@ -873,7 +842,7 @@ jQuery.extend({ // one special, otherwise get the value ret = name == "display" && swap[ stack.length - 1 ] != null ? "none" : - ( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || ""; + document.defaultView.getComputedStyle( elem, null ).getPropertyValue( name ) || ""; // Finally, revert the display styles back for ( var i = 0; i < swap.length; i++ ) @@ -918,9 +887,6 @@ jQuery.extend({ 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') - context = context.ownerDocument || context[0] && context[0].ownerDocument || document; jQuery.each(elems, function(i, elem){ if ( !elem ) @@ -944,7 +910,7 @@ jQuery.extend({ var wrap = // option or optgroup !tags.indexOf("", "" ] || + [ 1, "" ] || !tags.indexOf("", "" ] || @@ -983,18 +949,18 @@ jQuery.extend({ div.firstChild && div.firstChild.childNodes : // String was a bare or - wrap[1] == "" && tags.indexOf("" && s.indexOf("= 0 ; --j ) - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) - tbody[ j ].parentNode.removeChild( tbody[ j ] ); - + + for ( var i = tbody.length - 1; i >= 0 ; --i ) + if ( jQuery.nodeName( tbody[ i ], "tbody" ) && !tbody[ i ].childNodes.length ) + tbody[ i ].parentNode.removeChild( tbody[ i ] ); + // IE completely kills leading whitespace when innerHTML is used if ( /^\s/.test( elem ) ) div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); - + } elem = jQuery.makeArray( div.childNodes ); @@ -1015,10 +981,6 @@ jQuery.extend({ }, attr: function( elem, name, value ) { - // don't set attributes on text and comment nodes - if (!elem || elem.nodeType == 3 || elem.nodeType == 8) - return undefined; - var fix = jQuery.isXMLDoc( elem ) ? {} : jQuery.props; @@ -1049,8 +1011,7 @@ jQuery.extend({ if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) throw "type property can't be changed"; - // convert the value to a string (all browsers do this but IE) see #1070 - elem.setAttribute( name, "" + value ); + elem.setAttribute( name, value ); } if ( jQuery.browser.msie && /href|src/.test( name ) && !jQuery.isXMLDoc( elem ) ) @@ -1072,7 +1033,7 @@ jQuery.extend({ (parseFloat( value ).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); } - return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? + return elem.filter ? (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : ""; } @@ -1222,10 +1183,7 @@ jQuery.extend({ readonly: "readOnly", selected: "selected", maxlength: "maxLength", - selectedIndex: "selectedIndex", - defaultValue: "defaultValue", - tagName: "tagName", - nodeName: "nodeName" + selectedIndex: "selectedIndex" } }); @@ -1272,8 +1230,7 @@ jQuery.each({ jQuery.each({ removeAttr: function( name ) { jQuery.attr( this, name, "" ); - if (this.nodeType == 1) - this.removeAttribute( name ); + this.removeAttribute( name ); }, addClass: function( classNames ) { @@ -1290,21 +1247,17 @@ jQuery.each({ remove: function( selector ) { if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { - // Prevent memory leaks - jQuery( "*", this ).add(this).each(function(){ - jQuery.event.remove(this); - jQuery.removeData(this); - }); - if (this.parentNode) - this.parentNode.removeChild( this ); + jQuery.removeData( this ); + this.parentNode.removeChild( this ); } }, empty: function() { - // Remove element nodes and prevent memory leaks - jQuery( ">*", this ).remove(); - - // Remove any remaining nodes + // Clean up the cache + jQuery( "*", this ).each(function(){ + jQuery.removeData(this); + }); + while ( this.firstChild ) this.removeChild( this.firstChild ); } @@ -1324,19 +1277,16 @@ jQuery.each([ "Height", "Width" ], function(i, name){ jQuery.browser.opera && document.body[ "client" + name ] || // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths) - jQuery.browser.safari && window[ "inner" + name ] || + jQuery.browser.safari && self[ "inner" + name ] || // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] : // Get document width or height this[0] == document ? - // Either scroll[Width/Height] or offset[Width/Height], whichever is greater - Math.max( - Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), - Math.max(document.body["offset" + name], document.documentElement["offset" + name]) - ) : - + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater (Mozilla reports scrollWidth the same as offsetWidth) + Math.max( document.body[ "scroll" + name ], document.body[ "offset" + name ] ) : + // Get or set width or height on the element size == undefined ? // Get width or height on the element @@ -1444,15 +1394,15 @@ jQuery.extend({ if ( typeof t != "string" ) return [ t ]; - // check to make sure context is a DOM element or a document - if ( context && context.nodeType != 1 && context.nodeType != 9) - return [ ]; + // Make sure that the context is a DOM Element + if ( context && !context.nodeType ) + context = null; // Set the correct context (if none is provided) context = context || document; // Initialize the search - var ret = [context], done = [], last, nodeName; + var ret = [context], done = [], last; // Continue while a selector expression exists, and while // we're no longer looping upon ourselves @@ -1470,12 +1420,12 @@ jQuery.extend({ var m = re.exec(t); if ( m ) { - nodeName = m[1].toUpperCase(); + var nodeName = m[1].toUpperCase(); // Perform our own iteration and filter for ( var i = 0; ret[i]; i++ ) for ( var c = ret[i].firstChild; c; c = c.nextSibling ) - if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) ) + if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName.toUpperCase()) ) r.push( c ); ret = r; @@ -1488,8 +1438,7 @@ jQuery.extend({ if ( (m = re.exec(t)) != null ) { r = []; - var merge = {}; - nodeName = m[2].toUpperCase(); + var nodeName = m[2], merge = {}; m = m[1]; for ( var j = 0, rl = ret.length; j < rl; j++ ) { @@ -1500,7 +1449,7 @@ jQuery.extend({ if ( m == "~" && merge[id] ) break; - if (!nodeName || n.nodeName.toUpperCase() == nodeName ) { + if (!nodeName || n.nodeName.toUpperCase() == nodeName.toUpperCase() ) { if ( m == "~" ) merge[id] = true; r.push( n ); } @@ -1541,7 +1490,7 @@ jQuery.extend({ // Re-organize the results, so that they're consistent if ( m ) { - m = [ 0, m[2], m[3], m[1] ]; + m = [ 0, m[2], m[3], m[1] ]; } else { // Otherwise, do a traditional filter check for @@ -1646,7 +1595,7 @@ jQuery.extend({ var last; // Look for common filter expressions - while ( t && t != last ) { + while ( t && t != last ) { last = t; var p = jQuery.parse, m; @@ -1669,10 +1618,7 @@ jQuery.extend({ // :not() is a special case that can be optimized by // keeping it out of the expression list if ( m[1] == ":" && m[2] == "not" ) - // optimize if only one selector found (most common case) - r = isSimple.test( m[3] ) ? - jQuery.filter(m[3], r, true).r : - jQuery( r ).not( m[3] ); + r = jQuery.filter(m[3], r, true).r; // We can get a big speed boost by filtering by class here else if ( m[1] == "." ) @@ -1701,14 +1647,11 @@ jQuery.extend({ // We can get a speed boost by handling nth-child here } else if ( m[1] == ":" && m[2] == "nth-child" ) { var merge = {}, tmp = [], - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( + test = /(\d*)n\+?(\d*)/.exec( m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || - !/\D/.test(m[3]) && "0n+" + m[3] || m[3]), - // calculate the numbers (first)n+(last) including if they are negative - first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0; - - // loop through all the elements left in the jQuery object + !/\D/.test(m[3]) && "n+" + m[3] || m[3]), + first = (test[1] || 1) - 0, last = test[2] - 0; + for ( var i = 0, rl = r.length; i < rl; i++ ) { var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode); @@ -1724,10 +1667,10 @@ jQuery.extend({ var add = false; - if ( first == 0 ) { - if ( node.nodeIndex == last ) + if ( first == 1 ) { + if ( last == 0 || node.nodeIndex == last ) add = true; - } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 ) + } else if ( (node.nodeIndex + last) % first == 0 ) add = true; if ( add ^ not ) @@ -1788,7 +1731,6 @@ jQuery.extend({ return r; } }); - /* * A number of helper functions used for managing events. * Many of the ideas behind this code orignated from @@ -1798,14 +1740,11 @@ jQuery.event = { // Bind an event to an element // Original by Dean Edwards - add: function(elem, types, handler, data) { - if ( elem.nodeType == 3 || elem.nodeType == 8 ) - return; - + add: function(element, type, handler, data) { // For whatever reason, IE has trouble passing the window object // around, causing it to be cloned in the process - if ( jQuery.browser.msie && elem.setInterval != undefined ) - elem = window; + if ( jQuery.browser.msie && element.setInterval != undefined ) + element = window; // Make sure that the function being executed has a unique ID if ( !handler.guid ) @@ -1813,7 +1752,7 @@ jQuery.event = { // if data is passed, bind to handler if( data != undefined ) { - // Create temporary function pointer to original handler + // Create temporary function pointer to original handler var fn = handler; // Create unique handler function, wrapped around original handler @@ -1829,179 +1768,149 @@ jQuery.event = { handler.guid = fn.guid; } + // Namespaced event handlers + var parts = type.split("."); + type = parts[0]; + handler.type = parts[1]; + // Init the element's event structure - var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), - handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ - // returned undefined or false - var val; + var events = jQuery.data(element, "events") || jQuery.data(element, "events", {}); + + var handle = jQuery.data(element, "handle", function(){ + // returned undefined or false + var val; - // Handle the second event of a trigger and when - // an event is called after a page has unloaded - if ( typeof jQuery == "undefined" || jQuery.event.triggered ) - return val; - - val = jQuery.event.handle.apply(elem, arguments); - + // Handle the second event of a trigger and when + // an event is called after a page has unloaded + if ( typeof jQuery == "undefined" || jQuery.event.triggered ) return val; - }); - // Handle multiple events seperated by a space - // jQuery(...).bind("mouseover mouseout", fn); - jQuery.each(types.split(/\s+/), function(index, type) { - // Namespaced event handlers - var parts = type.split("."); - type = parts[0]; - handler.type = parts[1]; + val = jQuery.event.handle.apply(element, arguments); + + return val; + }); - // Get the current list of functions bound to this event - var handlers = events[type]; + // Get the current list of functions bound to this event + var handlers = events[type]; - // Init the event handler queue - if (!handlers) { - handlers = events[type] = {}; - - // Check for a special event handler - // Only use addEventListener/attachEvent if the special - // events handler returns false - if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) { - // Bind the global event handler to the element - if (elem.addEventListener) - elem.addEventListener(type, handle, false); - else if (elem.attachEvent) - elem.attachEvent("on" + type, handle); - } - } + // Init the event handler queue + if (!handlers) { + handlers = events[type] = {}; + + // And bind the global event handler to the element + if (element.addEventListener) + element.addEventListener(type, handle, false); + else + element.attachEvent("on" + type, handle); + } - // Add the function to the element's handler list - handlers[handler.guid] = handler; + // Add the function to the element's handler list + handlers[handler.guid] = handler; - // Keep track of which events have been used, for global triggering - jQuery.event.global[type] = true; - }); + // Keep track of which events have been used, for global triggering + this.global[type] = true; }, guid: 1, global: {}, // Detach an event or set of events from an element - remove: function(elem, types, handler) { - // don't do events on text and comment nodes - if ( elem.nodeType == 3 || elem.nodeType == 8 ) - return; + remove: function(element, type, handler) { + var events = jQuery.data(element, "events"), ret, index; - var events = jQuery.data(elem, "events"), ret, index; + // Namespaced event handlers + if ( typeof type == "string" ) { + var parts = type.split("."); + type = parts[0]; + } if ( events ) { - // Unbind all events for the element - if ( types == undefined ) - for ( var type in events ) - this.remove( elem, type ); - else { - // types is actually an event object here - if ( types.type ) { - handler = types.handler; - types = types.type; - } - - // Handle multiple events seperated by a space - // jQuery(...).unbind("mouseover mouseout", fn); - jQuery.each(types.split(/\s+/), function(index, type){ - // Namespaced event handlers - var parts = type.split("."); - type = parts[0]; - - if ( events[type] ) { - // remove the given handler for the given type - if ( handler ) - delete events[type][handler.guid]; + // type is actually an event object here + if ( type && type.type ) { + handler = type.handler; + type = type.type; + } - // remove all handlers for the given type - else - for ( handler in events[type] ) - // Handle the removal of namespaced events - if ( !parts[1] || events[type][handler].type == parts[1] ) - delete events[type][handler]; + if ( !type ) { + for ( type in events ) + this.remove( element, type ); - // remove generic event handler if no more handlers exist - for ( ret in events[type] ) break; - if ( !ret ) { - if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) { - if (elem.removeEventListener) - elem.removeEventListener(type, jQuery.data(elem, "handle"), false); - else if (elem.detachEvent) - elem.detachEvent("on" + type, jQuery.data(elem, "handle")); - } - ret = null; - delete events[type]; - } - } - }); + } else if ( events[type] ) { + // remove the given handler for the given type + if ( handler ) + delete events[type][handler.guid]; + + // remove all handlers for the given type + else + for ( handler in events[type] ) + // Handle the removal of namespaced events + if ( !parts[1] || events[type][handler].type == parts[1] ) + delete events[type][handler]; + + // remove generic event handler if no more handlers exist + for ( ret in events[type] ) break; + if ( !ret ) { + if (element.removeEventListener) + element.removeEventListener(type, jQuery.data(element, "handle"), false); + else + element.detachEvent("on" + type, jQuery.data(element, "handle")); + ret = null; + delete events[type]; + } } // Remove the expando if it's no longer used for ( ret in events ) break; if ( !ret ) { - jQuery.removeData( elem, "events" ); - jQuery.removeData( elem, "handle" ); + jQuery.removeData( element, "events" ); + jQuery.removeData( element, "handle" ); } } }, - trigger: function(type, data, elem, donative, extra) { + trigger: function(type, data, element, donative, extra) { // Clone the incoming data, if any data = jQuery.makeArray(data || []); // Handle a global trigger - if ( !elem ) { + if ( !element ) { // Only trigger if we've ever bound an event for it if ( this.global[type] ) jQuery("*").add([window, document]).trigger(type, data); // Handle triggering a single element } else { - // don't do events on text and comment nodes - if ( elem.nodeType == 3 || elem.nodeType == 8 ) - return undefined; - - var val, ret, fn = jQuery.isFunction( elem[ type ] || null ), + var val, ret, fn = jQuery.isFunction( element[ type ] || null ), // Check to see if we need to provide a fake event, or not - event = !data[0] || !data[0].preventDefault; + evt = !data[0] || !data[0].preventDefault; // Pass along a fake event - if ( event ) - data.unshift( this.fix({ type: type, target: elem }) ); + if ( evt ) + data.unshift( this.fix({ type: type, target: element }) ); // Enforce the right trigger type data[0].type = type; // Trigger the event - if ( jQuery.isFunction( jQuery.data(elem, "handle") ) ) - val = jQuery.data(elem, "handle").apply( elem, data ); + if ( jQuery.isFunction( jQuery.data(element, "handle") ) ) + val = jQuery.data(element, "handle").apply( element, data ); // Handle triggering native .onfoo handlers - if ( !fn && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) + if ( !fn && element["on"+type] && element["on"+type].apply( element, data ) === false ) val = false; // Extra functions don't get the custom event object - if ( event ) + if ( evt ) data.shift(); // Handle triggering of extra function - if ( extra && jQuery.isFunction( extra ) ) { - // call the extra function and tack the current return value on the end for possible inspection - var ret = extra.apply( elem, data.concat( val ) ); - // if anything is returned, give it precedence and have it overwrite the previous value - if (ret !== undefined) - val = ret; - } + if ( extra && extra.apply( element, data ) === false ) + val = false; // Trigger the native events (except for clicks on links) - if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) { + if ( fn && donative !== false && val !== false && !(jQuery.nodeName(element, 'a') && type == "click") ) { this.triggered = true; - try { - elem[ type ](); - // prevent IE from throwing an error for some hidden elements - } catch (e) {} + element[ type ](); } this.triggered = false; @@ -2021,24 +1930,23 @@ jQuery.event = { var parts = event.type.split("."); event.type = parts[0]; - var handlers = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 ); + var c = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 ); args.unshift( event ); - for ( var j in handlers ) { - var handler = handlers[j]; + for ( var j in c ) { // Pass in a reference to the handler function itself // So that we can later remove it - args[0].handler = handler; - args[0].data = handler.data; + args[0].handler = c[j]; + args[0].data = c[j].data; // Filter the functions by class - if ( !parts[1] || handler.type == parts[1] ) { - var ret = handler.apply( this, args ); + if ( !parts[1] || c[j].type == parts[1] ) { + var tmp = c[j].apply( this, args ); if ( val !== false ) - val = ret; + val = tmp; - if ( ret === false ) { + if ( tmp === false ) { event.preventDefault(); event.stopPropagation(); } @@ -2054,18 +1962,11 @@ jQuery.event = { }, fix: function(event) { - // Short-circuit if the event has already been fixed by jQuery.event.fix - if ( event[ expando ] ) - return event; - // store a copy of the original event object // and clone to set read-only properties var originalEvent = event; event = jQuery.extend({}, originalEvent); - // Mark the event as fixed by jQuery.event.fix - event[ expando ] = true; - // add preventDefault and stopPropagation since // they will not work on the clone event.preventDefault = function() { @@ -2084,11 +1985,11 @@ jQuery.event = { }; // Fix target property, if necessary - if ( !event.target ) - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either + if ( !event.target && event.srcElement ) + event.target = event.srcElement; // check if target is a textnode (safari) - if ( event.target.nodeType == 3 ) + if (jQuery.browser.safari && event.target.nodeType == 3) event.target = originalEvent.target.parentNode; // Add relatedTarget, if necessary @@ -2097,9 +1998,9 @@ jQuery.event = { // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && event.clientX != null ) { - var doc = document.documentElement, body = document.body; - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); + var e = document.documentElement, b = document.body; + event.pageX = event.clientX + (e && e.scrollLeft || b && b.scrollLeft || 0); + event.pageY = event.clientY + (e && e.scrollTop || b && b.scrollTop || 0); } // Add which for key events @@ -2116,62 +2017,6 @@ jQuery.event = { event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); return event; - }, - - special: { - ready: { - setup: function() { - // Make sure the ready event is setup - bindReady(); - return; - }, - - teardown: function() { return; } - }, - - mouseenter: { - setup: function() { - if ( jQuery.browser.msie ) return false; - jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler); - return true; - }, - - teardown: function() { - if ( jQuery.browser.msie ) return false; - jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler); - return true; - }, - - handler: function(event) { - // If we actually just moused on to a sub-element, ignore it - if ( withinElement(event, this) ) return true; - // Execute the right handlers by setting the event type to mouseenter - arguments[0].type = "mouseenter"; - return jQuery.event.handle.apply(this, arguments); - } - }, - - mouseleave: { - setup: function() { - if ( jQuery.browser.msie ) return false; - jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler); - return true; - }, - - teardown: function() { - if ( jQuery.browser.msie ) return false; - jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler); - return true; - }, - - handler: function(event) { - // If we actually just moused on to a sub-element, ignore it - if ( withinElement(event, this) ) return true; - // Execute the right handlers by setting the event type to mouseleave - arguments[0].type = "mouseleave"; - return jQuery.event.handle.apply(this, arguments); - } - } } }; @@ -2206,50 +2051,70 @@ jQuery.fn.extend({ triggerHandler: function( type, data, fn ) { if ( this[0] ) return jQuery.event.trigger( type, data, this[0], false, fn ); - return undefined; }, toggle: function() { // Save reference to arguments for access in closure - var args = arguments; + var a = arguments; - return this.click(function(event) { + return this.click(function(e) { // Figure out which function to execute this.lastToggle = 0 == this.lastToggle ? 1 : 0; // Make sure that clicks stop - event.preventDefault(); + e.preventDefault(); // and execute the function - return args[this.lastToggle].apply( this, arguments ) || false; + return a[this.lastToggle].apply( this, [e] ) || false; }); }, - hover: function(fnOver, fnOut) { - return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut); + hover: function(f,g) { + + // A private function for handling mouse 'hovering' + function handleHover(e) { + // Check if mouse(over|out) are still within the same parent element + var p = e.relatedTarget; + + // Traverse up the tree + while ( p && p != this ) try { p = p.parentNode; } catch(e) { p = this; }; + + // If we actually just moused on to a sub-element, ignore it + if ( p == this ) return false; + + // Execute the right function + return (e.type == "mouseover" ? f : g).apply(this, [e]); + } + + // Bind the function to the two event listeners + return this.mouseover(handleHover).mouseout(handleHover); }, - ready: function(fn) { + ready: function(f) { // Attach the listeners bindReady(); // If the DOM is already ready if ( jQuery.isReady ) // Execute the function immediately - fn.call( document, jQuery ); + f.apply( document, [jQuery] ); // Otherwise, remember the function for later else // Add the function to the wait list - jQuery.readyList.push( function() { return fn.call(this, jQuery); } ); + jQuery.readyList.push( function() { return f.apply(this, [jQuery]); } ); return this; } }); jQuery.extend({ + /* + * All the code that makes DOM Ready work nicely. + */ isReady: false, readyList: [], + // Handle when the DOM is ready ready: function() { // Make sure that the DOM is not already loaded @@ -2267,102 +2132,58 @@ jQuery.extend({ // Reset the list of functions jQuery.readyList = null; } - - // Trigger any bound ready events - $(document).triggerHandler("ready"); + // Remove event listener to avoid memory leak + if ( jQuery.browser.mozilla || jQuery.browser.opera ) + document.removeEventListener( "DOMContentLoaded", jQuery.ready, false ); } } }); + +jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + + "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + + "submit,keydown,keypress,keyup,error").split(","), function(i,o){ + + // Handle event binding + jQuery.fn[o] = function(f){ + return f ? this.bind(o, f) : this.trigger(o); + }; +}); + var readyBound = false; function bindReady(){ if ( readyBound ) return; readyBound = true; - // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event - if ( document.addEventListener && !jQuery.browser.opera) + // If Mozilla is used + if ( jQuery.browser.mozilla || jQuery.browser.opera ) // Use the handy event callback document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); - // If IE is used and is not in a frame - // Continually check to see if the document is ready - if ( jQuery.browser.msie && window == top ) (function(){ - if (jQuery.isReady) return; - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch( error ) { - setTimeout( arguments.callee, 0 ); - return; + // If Safari or IE is used + else { + // Continually check to see if the document is ready + function timer(){ + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + if ( jQuery.browser.msie || document.readyState != "loaded" && document.readyState != "complete" ) + document.documentElement.doScroll("left"); + + // and execute any waiting functions + jQuery.ready(); + } catch( error ) { + setTimeout( timer, 0 ); + } } - // and execute any waiting functions - jQuery.ready(); - })(); - if ( jQuery.browser.opera ) - document.addEventListener( "DOMContentLoaded", function () { - if (jQuery.isReady) return; - for (var i = 0; i < document.styleSheets.length; i++) - if (document.styleSheets[i].disabled) { - setTimeout( arguments.callee, 0 ); - return; - } - // and execute any waiting functions - jQuery.ready(); - }, false); - - if ( jQuery.browser.safari ) { - var numStyles; - (function(){ - if (jQuery.isReady) return; - if ( document.readyState != "loaded" && document.readyState != "complete" ) { - setTimeout( arguments.callee, 0 ); - return; - } - if ( numStyles === undefined ) - numStyles = jQuery("style, link[rel=stylesheet]").length; - if ( document.styleSheets.length != numStyles ) { - setTimeout( arguments.callee, 0 ); - return; - } - // and execute any waiting functions - jQuery.ready(); - })(); + timer(); } // A fallback to window.onload, that will always work jQuery.event.add( window, "load", jQuery.ready ); } - -jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + - "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + - "submit,keydown,keypress,keyup,error").split(","), function(i, name){ - - // Handle event binding - jQuery.fn[name] = function(fn){ - return fn ? this.bind(name, fn) : this.trigger(name); - }; -}); - -// Checks if an event happened on an element within another element -// Used in jQuery.event.special.mouseenter and mouseleave handlers -var withinElement = function(event, elem) { - // Check if mouse(over|out) are still within the same parent element - var parent = event.relatedTarget; - // Traverse up the tree - while ( parent && parent != elem ) try { parent = parent.parentNode } catch(error) { parent = elem; }; - // Return true if we actually just moused on to a sub-element - return parent == elem; -}; - -// Prevent memory leaks in IE -// And prevent errors on refresh with events like mouseover in other browsers -// Window isn't included so as not to unbind existing unload events -jQuery(window).bind("unload", function() { - jQuery("*").add(document).unbind(); -}); jQuery.fn.extend({ load: function( url, params, callback ) { if ( jQuery.isFunction( url ) ) @@ -2399,7 +2220,6 @@ jQuery.fn.extend({ jQuery.ajax({ url: url, type: type, - dataType: "html", data: params, complete: function(res, status){ // If successful, inject the HTML into all the matched elements @@ -2418,7 +2238,10 @@ jQuery.fn.extend({ // If not, just inject the full result res.responseText ); - self.each( callback, [res.responseText, status, res] ); + // Add delay to account for Safari's delay in globalEval + setTimeout(function(){ + self.each( callback, [res.responseText, status, res] ); + }, 13); } }); return this; @@ -2516,7 +2339,7 @@ jQuery.extend({ lastModified: {}, ajax: function( s ) { - var jsonp, jsre = /=\?(&|$)/g, status, data; + var jsonp, jsre = /=(\?|%3F)/g, status, data; // Extend the settings, but re-extend 's' so that it can be // checked again later (in the test suite, specifically) @@ -2542,8 +2365,8 @@ jQuery.extend({ // Replace the =? sequence both in the query string and the data if ( s.data ) - s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); - s.url = s.url.replace(jsre, "=" + jsonp + "$1"); + s.data = s.data.replace(jsre, "=" + jsonp); + s.url = s.url.replace(jsre, "=" + jsonp); // We need to make sure // that a JSONP style response is executed properly @@ -2557,21 +2380,14 @@ jQuery.extend({ // Garbage collect window[ jsonp ] = undefined; try{ delete window[ jsonp ]; } catch(e){} - if ( head ) - head.removeChild( script ); }; } if ( s.dataType == "script" && s.cache == null ) s.cache = false; - if ( s.cache === false && s.type.toLowerCase() == "get" ) { - var ts = (new Date()).getTime(); - // try replacing _= if it is there - var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); - // if nothing was replaced, add timestamp to the end - s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); - } + if ( s.cache === false && s.type.toLowerCase() == "get" ) + s.url += (s.url.match(/\?/) ? "&" : "?") + "_=" + (new Date()).getTime(); // If data is available, append data to url for get requests if ( s.data && s.type.toLowerCase() == "get" ) { @@ -2586,16 +2402,14 @@ jQuery.extend({ jQuery.event.trigger( "ajaxStart" ); // If we're requesting a remote document - // and trying to load JSON or Script with a GET - if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) { + // and trying to load JSON or Script + if ( !s.url.indexOf("http") && s.dataType == "script" ) { var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = s.url; - if (s.scriptCharset) - script.charset = s.scriptCharset; // Handle Script loading - if ( !jsonp ) { + if ( !jsonp && (s.success || s.complete) ) { var done = false; // Attach handlers for all browsers @@ -2613,7 +2427,7 @@ jQuery.extend({ head.appendChild(script); // We handle everything using the script element injection - return undefined; + return; } var requestDone = false; @@ -2625,27 +2439,24 @@ jQuery.extend({ // Open the socket xml.open(s.type, s.url, s.async); - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - // Set the correct header, if data is being sent - if ( s.data ) - xml.setRequestHeader("Content-Type", s.contentType); + // Set the correct header, if data is being sent + if ( s.data ) + xml.setRequestHeader("Content-Type", s.contentType); - // Set the If-Modified-Since header, if ifModified mode. - if ( s.ifModified ) - xml.setRequestHeader("If-Modified-Since", - jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); + // Set the If-Modified-Since header, if ifModified mode. + if ( s.ifModified ) + xml.setRequestHeader("If-Modified-Since", + jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); - // Set header so the called script knows that it's an XMLHttpRequest - xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - } catch(e){} + // Set header so the called script knows that it's an XMLHttpRequest + xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); // Allow custom headers/mimetypes if ( s.beforeSend ) s.beforeSend(xml); if ( s.global ) - jQuery.event.trigger("ajaxSend", [xml, s]); + jQuery.event.trigger("ajaxSend", [xml, s]); // Wait for a response to come back var onreadystatechange = function(isTimeout){ @@ -2728,6 +2539,9 @@ jQuery.extend({ // firefox 1.5 doesn't fire statechange for sync requests if ( !s.async ) onreadystatechange(); + + // return XMLHttpRequest to allow aborting the request etc. + return xml; function success(){ // If a local callback was specified, fire it and pass it the data @@ -2752,9 +2566,6 @@ jQuery.extend({ if ( s.global && ! --jQuery.active ) jQuery.event.trigger( "ajaxStop" ); } - - // return XMLHttpRequest to allow aborting the request etc. - return xml; }, handleError: function( s, xml, status, e ) { @@ -2772,9 +2583,8 @@ jQuery.extend({ // Determines if an XMLHttpRequest was successful or not httpSuccess: function( r ) { try { - // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !r.status && location.protocol == "file:" || - ( r.status >= 200 && r.status < 300 ) || r.status == 304 || r.status == 1223 || + ( r.status >= 200 && r.status < 300 ) || r.status == 304 || jQuery.browser.safari && r.status == undefined; } catch(e){} return false; @@ -2849,12 +2659,9 @@ jQuery.fn.extend({ }, speed, callback) : this.filter(":hidden").each(function(){ - this.style.display = this.oldblock || ""; - if ( jQuery.css(this,"display") == "none" ) { - var elem = jQuery("<" + this.tagName + " />").appendTo("body"); - this.style.display = elem.css("display"); - elem.remove(); - } + this.style.display = this.oldblock ? this.oldblock : ""; + if ( jQuery.css(this,"display") == "none" ) + this.style.display = "block"; }).end(); }, @@ -2866,6 +2673,8 @@ jQuery.fn.extend({ this.filter(":visible").each(function(){ this.oldblock = this.oldblock || jQuery.css(this,"display"); + if ( this.oldblock == "none" ) + this.oldblock = "block"; this.style.display = "none"; }).end(); }, @@ -2910,13 +2719,10 @@ jQuery.fn.extend({ }, animate: function( prop, speed, easing, callback ) { - var optall = jQuery.speed(speed, easing, callback); + var opt = jQuery.speed(speed, easing, callback); - return this[ optall.queue === false ? "each" : "queue" ](function(){ - if ( this.nodeType != 1) - return false; - - var opt = jQuery.extend({}, optall); + return this[ opt.queue === false ? "each" : "queue" ](function(){ + opt = jQuery.extend({}, opt); var hidden = jQuery(this).is(":hidden"), self = this; for ( var p in prop ) { @@ -2973,7 +2779,7 @@ jQuery.fn.extend({ }, queue: function(type, fn){ - if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) { + if ( jQuery.isFunction(type) ) { fn = type; type = "fx"; } @@ -2982,9 +2788,6 @@ jQuery.fn.extend({ return queue( this[0], type ); return this.each(function(){ - if ( this.nodeType != 1) - return; - if ( fn.constructor == Array ) queue(this, type, fn); else { @@ -2996,37 +2799,21 @@ jQuery.fn.extend({ }); }, - stop: function(clearQueue, gotoEnd){ + stop: function(){ var timers = jQuery.timers; - if (clearQueue) - this.queue([]); - - this.each(function(){ - // go in reverse order so anything added to the queue during the loop is ignored - for ( var i = timers.length - 1; i >= 0; i-- ) - if ( timers[i].elem == this ) { - if (gotoEnd) - // force the next step to be the last - timers[i](true); - timers.splice(i, 1); - } - }); - - // start the next in the queue if the last step wasn't forced - if (!gotoEnd) - this.dequeue(); - - return this; + return this.each(function(){ + for ( var i = 0; i < timers.length; i++ ) + if ( timers[i].elem == this ) + timers.splice(i--, 1); + }).dequeue(); } }); var queue = function( elem, type, array ) { if ( !elem ) - return undefined; - - type = type || "fx"; + return; var q = jQuery.data( elem, type + "queue" ); @@ -3067,8 +2854,7 @@ jQuery.extend({ // Queueing opt.old = opt.complete; opt.complete = function(){ - if ( opt.queue !== false ) - jQuery(this).dequeue(); + jQuery(this).dequeue(); if ( jQuery.isFunction( opt.old ) ) opt.old.apply( this ); }; @@ -3086,7 +2872,6 @@ jQuery.extend({ }, timers: [], - timerId: null, fx: function( elem, options, prop ){ this.options = options; @@ -3118,8 +2903,8 @@ jQuery.fx.prototype = { if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null ) return this.elem[ this.prop ]; - var r = parseFloat(jQuery.css(this.elem, this.prop, force)); - return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; + var r = parseFloat(jQuery.curCSS(this.elem, this.prop, force)); + return r && r > -10000 ? r : parseFloat(jQuery.css(this.elem, this.prop)) || 0; }, // Start an animation from one number to another @@ -3133,26 +2918,24 @@ jQuery.fx.prototype = { this.update(); var self = this; - function t(gotoEnd){ - return self.step(gotoEnd); + function t(){ + return self.step(); } t.elem = this.elem; jQuery.timers.push(t); - if ( jQuery.timerId == null ) { - jQuery.timerId = setInterval(function(){ + if ( jQuery.timers.length == 1 ) { + var timer = setInterval(function(){ var timers = jQuery.timers; for ( var i = 0; i < timers.length; i++ ) if ( !timers[i]() ) timers.splice(i--, 1); - if ( !timers.length ) { - clearInterval( jQuery.timerId ); - jQuery.timerId = null; - } + if ( !timers.length ) + clearInterval( timer ); }, 13); } }, @@ -3186,10 +2969,10 @@ jQuery.fx.prototype = { }, // Each step of an animation - step: function(gotoEnd){ + step: function(){ var t = (new Date()).getTime(); - if ( gotoEnd || t > this.options.duration + this.startTime ) { + if ( t > this.options.duration + this.startTime ) { this.now = this.end; this.pos = this.state = 1; this.update(); @@ -3269,7 +3052,7 @@ jQuery.fn.offset = function() { var left = 0, top = 0, elem = this[0], results; if ( elem ) with ( jQuery.browser ) { - var parent = elem.parentNode, + var parent = elem.parentNode, offsetChild = elem, offsetParent = elem.offsetParent, doc = elem.ownerDocument, @@ -3281,23 +3064,26 @@ jQuery.fn.offset = function() { var box = elem.getBoundingClientRect(); // Add the document scroll offsets - add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), - box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)); + add( + box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), + box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop) + ); // IE adds the HTML element's border, by default it is medium which is 2px - // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; } + // IE 6 and IE 7 quirks mode the border width is overwritable by the following css html { border: 0; } // IE 7 standards mode, the border is always 2px - // This border/offset is typically represented by the clientLeft and clientTop properties - // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS - // Therefore this method will be off by 2px in IE while in quirksmode - add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop ); + if ( msie ) { + var border = jQuery("html").css("borderWidth"); + border = (border == "medium" || jQuery.boxModel && parseInt(version) >= 7) && 2 || border; + add( -border, -border ); + } // Otherwise loop through the offsetParents and parentNodes } else { // Initial element offsets add( elem.offsetLeft, elem.offsetTop ); - + // Get parent offsets while ( offsetParent ) { // Add offsetParent offsets @@ -3319,9 +3105,9 @@ jQuery.fn.offset = function() { } // Get parent scroll offsets - while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) { - // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug - if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) ) + while ( parent.tagName && !/^body|html$/i.test(parent.tagName) ) { + // Remove parent scroll UNLESS that parent is inline or a table-row to work around Opera inline/table scrollLeft/Top bug + if ( !/^inline|table-row.*$/i.test(jQuery.css(parent, "display")) ) // Subtract parent scroll offsets add( -parent.scrollLeft, -parent.scrollTop ); @@ -3336,28 +3122,30 @@ jQuery.fn.offset = function() { // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild // Mozilla doubles body offsets with a non-absolutely positioned offsetChild if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) || - (mozilla && jQuery.css(offsetChild, "position") != "absolute") ) + (mozilla && jQuery.css(offsetChild, "position") != "absoltue") ) add( -doc.body.offsetLeft, -doc.body.offsetTop ); // Add the document scroll offsets if position is fixed if ( fixed ) - add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), - Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)); + add( + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop) + ); } // Return an object with top and left properties results = { top: top, left: left }; } + return results; + function border(elem) { - add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) ); + add( jQuery.css(elem, "borderLeftWidth"), jQuery.css(elem, "borderTopWidth") ); } function add(l, t) { left += parseInt(l) || 0; top += parseInt(t) || 0; } - - return results; }; })(); diff --git a/thirdparty/jquery-metadata/test/test.js b/thirdparty/jquery-metadata/test/test.js old mode 100644 new mode 100755 index 36a9627cb..c52e806a8 --- a/thirdparty/jquery-metadata/test/test.js +++ b/thirdparty/jquery-metadata/test/test.js @@ -1,79 +1,85 @@ function testData(index) { - var data = jQuery.metadata.get(this); - switch(index) { - case 0: - ok( data.foo == "bar", "Check foo property" ); - ok( data.bar == "baz", "Check baz property" ); - ok( data.arr[0] == 1, "Check arr[0] property" ); - ok( data.arr[1] == 2, "Check arr[1] property" ); - break; - case 1: - ok( data.test == "bar", "Check test property" ); - ok( data.bar == "baz", "Check bar property" ); - break; - case 2: - ok( data.zoooo == "bar", "Check zoooo property" ); - ok( data.bar.test == "baz", "Check bar.test property" ); - break; - case 3: - ok( data.number, "Check number property" ); - ok( data.stuff[0] == 2, "Check stuff[0] property" ); - ok( data.stuff[1] == 8, "Check stuff[1] property" ); - break; - default: - ok( false, ["Assertion failed on index ", index, ", with data ", data].join('') ); - } + var data = jQuery.metadata.get(this); + switch(index) { + case 0: + ok( data.foo == "bar", "Check foo property" ); + ok( data.bar == "baz", "Check baz property" ); + ok( data.arr[0] == 1, "Check arr[0] property" ); + ok( data.arr[1] == 2, "Check arr[1] property" ); + break; + case 1: + ok( data.test == "bar", "Check test property" ); + ok( data.bar == "baz", "Check bar property" ); + break; + case 2: + ok( data.zoooo == "bar", "Check zoooo property" ); + ok( data.bar.test == "baz", "Check bar.test property" ); + break; + case 3: + ok( data.number, "Check number property" ); + ok( data.stuff[0] == 2, "Check stuff[0] property" ); + ok( data.stuff[1] == 8, "Check stuff[1] property" ); + break; + default: + ok( false, ["Assertion failed on index ", index, ", with data ", data].join('') ); + } } // check if set can be intercepted without breaking metadata plugin var oldSet = jQuery.fn.set; jQuery.fn.set = function() { - ok( true, "set was interecepted" ); - oldSet.apply(this, arguments); + ok( true, "set was interecepted" ); + oldSet.apply(this, arguments); }; //jQuery.meta.single = ""; test("meta: type attr - from data attribute", function() { - expect(11); - jQuery.metadata.setType("attr", "data"); - jQuery("#one li").each(testData); + expect(11); + jQuery.metadata.setType("attr", "data"); + jQuery("#one li").each(testData); }); test("meta: type class - from className", function() { - expect(11); - jQuery.metadata.setType( "class" ); - jQuery("#two li").each(testData); + expect(11); + jQuery.metadata.setType( "class" ); + jQuery("#two li").each(testData); }); test("meta: children script element - get data from child script element", function() { - expect(11); - jQuery.metadata.setType( "elem", "script" ); - jQuery("#three li").each(testData); + expect(11); + jQuery.metadata.setType( "elem", "script" ); + jQuery("#three li").each(testData); }); test("check if window doesn't break anything", function() { - jQuery(window).get(); + jQuery(window).get(); }); test("meta: default with single data object", function() { - expect(11); - jQuery.metadata.setType("attr","data"); - jQuery.metadata.defaults.single = "data"; - jQuery("#four li").each(testData); + expect(11); + jQuery.metadata.setType("attr","data"); + jQuery.metadata.defaults.single = "data"; + jQuery("#four li").each(testData); }); test("meta with select and class", function() { - expect(2); - jQuery.metadata.setType("class"); - jQuery.metadata.single = "stuff"; - var e = $('#meal').metadata(); - ok( e, "data property" ); - ok( e.required, "property on data property" ); + expect(2); + jQuery.metadata.setType("class"); + jQuery.metadata.single = "stuff"; + var e = $('#meal').metadata(); + ok( e, "data property" ); + ok( e.required, "property on data property" ); }); test("try to add and remove classes on metadata elements", function() { - $("#two li").addClass("foobar").addClass("foo bar").removeClass("foobar"); - ok( $("#two li").is(".foo"), 'Check class foo was added.' ); - ok( $("#two li").is(".bar"), 'Check class bar was added.' ); + $("#two li").addClass("foobar").addClass("foo bar").removeClass("foobar"); + ok( $("#two li").is(".foo"), 'Check class foo was added.' ); + ok( $("#two li").is(".bar"), 'Check class bar was added.' ); +}); + +test("meta: type html5 - from data-*", function() { + expect(11); + jQuery.metadata.setType("html5"); + jQuery("#five li").each(testData); }); \ No newline at end of file diff --git a/thirdparty/jquery-metadata/test/testrunner.js b/thirdparty/jquery-metadata/test/testrunner.js old mode 100644 new mode 100755 diff --git a/thirdparty/jquery-metadata/test/testsuite.css b/thirdparty/jquery-metadata/test/testsuite.css old mode 100644 new mode 100755