return jQuery;
},
- // This may seem like some crazy code, but trust me when I say that this
- // is the only cross-browser way to do this. --John
+ // See test/unit/core.js for details concerning this function.
isFunction: function( fn ) {
return !!fn && typeof fn != "string" && !fn.nodeName &&
fn.constructor != Array && /function/i.test( fn + "" );
// args is for internal usage only
each: function( object, callback, args ) {
if ( args ) {
- if ( object.length == undefined )
+ if ( object.length == undefined ) {
for ( var name in object )
- callback.apply( object[ name ], args );
- else
+ if ( callback.apply( object[ name ], args ) === false )
+ break;
+ } else
for ( var i = 0, length = object.length; i < length; i++ )
if ( callback.apply( object[ i ], args ) === false )
break;
// A special, fast, case for the most common use of each
} else {
- if ( object.length == undefined )
+ if ( object.length == undefined ) {
for ( var name in object )
- callback.call( object[ name ], name, object[ name ] );
- else
+ if ( callback.call( object[ name ], name, object[ name ] ) === false )
+ break;
+ } else
for ( var i = 0, length = object.length, value = object[0];
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
}
if ( name.match( /float/i ) )
name = styleFloat;
- if ( !force && elem.style[ name ] )
+ if ( !force && elem.style && elem.style[ name ] )
ret = elem.style[ name ];
else if ( document.defaultView && document.defaultView.getComputedStyle ) {
if ( typeof elem == "string" ) {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
- return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i) ?
+ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
all :
front + "></" + tag + ">";
});