From: Michael Dale Date: Fri, 15 Jan 2010 03:10:01 +0000 (+0000) Subject: * puts jquery computeStyle in try catch ( un-breaks usability / js2 integration ) X-Git-Tag: 1.31.0-rc.0~38262 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=8fb94cf9b7a7edffa0eecaa1af04b0328fa20ec2;p=lhc%2Fweb%2Fwiklou.git * puts jquery computeStyle in try catch ( un-breaks usability / js2 integration ) --- diff --git a/js2/js2stopgap.js b/js2/js2stopgap.js index 7f6d0d90fd..6d7626da35 100644 --- a/js2/js2stopgap.js +++ b/js2/js2stopgap.js @@ -804,9 +804,11 @@ jQuery.extend({ name = "float"; name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); - - var computedStyle = defaultView.getComputedStyle( elem, null ); - + try{ + var computedStyle = defaultView.getComputedStyle( elem, null ); + }catch(e){ + // Error in getting computedStyle + } if ( computedStyle ) ret = computedStyle.getPropertyValue( name ); diff --git a/js2/js2stopgap.min.js b/js2/js2stopgap.min.js index 4418afda41..5bd91489df 100644 --- a/js2/js2stopgap.min.js +++ b/js2/js2stopgap.min.js @@ -88,8 +88,8 @@ return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret if(name.match(/float/i)) name=styleFloat;if(!force&&style&&style[name]) ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i)) -name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle) -ret=computedStyle.getPropertyValue(name);if(name=="opacity"&&ret=="") +name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();try{var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle) +ret=computedStyle.getPropertyValue(name);}catch(e){};if(name=="opacity"&&ret=="") ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}} return ret;},clean:function(elems,context,fragment){context=context||document;if(typeof context.createElement==="undefined") context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);if(match)