if ( this.src )
jQuery.ajax({ url: this.src, async: false, dataType: "script" });
else
- (new Function( this.text || this.textContent || this.innerHTML || "" ))();
+ jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" );
} else
fn.apply( obj, [ clone ? this.cloneNode(true) : this ] );
});
elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
},
+ // Evalulates a script in a global context
+ // Evaluates Async. in Safari 2 :-(
+ globalEval: function( data ) {
+ data = jQuery.trim( data );
+ if ( data ) {
+ if ( window.execScript )
+ window.execScript( data );
+ else if ( jQuery.browser.safari )
+ // safari doesn't provide a synchronous global eval
+ window.setTimeout( data, 0 );
+ else
+ eval.call( window, data );
+ }
+ },
+
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
},
curCSS: function(elem, prop, force) {
- var ret, getComputedStyle = document.defaultView &&
- document.defaultView.getComputedStyle, stack = [], swap = [];
+ var ret, stack = [], swap = [];
+
+ // A helper method for determining if an element's values are broken
+ function color(a){
+ if ( !jQuery.browser.safari )
+ return false;
+
+ var ret = document.defaultView.getComputedStyle(a,null);
+ return !ret || ret.getPropertyValue("color") == "";
+ }
if (prop == "opacity" && jQuery.browser.msie) {
ret = jQuery.attr(elem.style, "opacity");
if (!force && elem.style[prop])
ret = elem.style[prop];
- else if (getComputedStyle) {
+ else if (document.defaultView && document.defaultView.getComputedStyle) {
if (prop.match(/float/i))
prop = "float";
prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
- var cur = getComputedStyle(elem, null);
+ var cur = document.defaultView.getComputedStyle(elem, null);
if ( cur && !color(elem) )
ret = cur.getPropertyValue(prop);
// one special, otherwise get the value
ret = prop == "display" && swap[stack.length-1] != null ?
"none" :
- getComputedStyle(elem,null).getPropertyValue(prop) || "";
+ document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || "";
// Finally, revert the display styles back
for ( a = 0; a < swap.length; a++ )
if ( prop == "opacity" && ret == "" )
ret = "1";
- // A helper method for determining if an element's values are broken
- function color(a){
- return jQuery.browser.safari && getComputedStyle(a,null).getPropertyValue("color") == "";
- }
-
} else if (elem.currentStyle) {
var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
for ( var n = tb.length-1; n >= 0 ; --n )
if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
tb[n].parentNode.removeChild(tb[n]);
-
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( /^\s/.test(arg) )
+ div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild );
+
}
arg = jQuery.makeArray( div.childNodes );