Skip to main content

Bug Tracker

Side navigation

Ticket #4707: fix.txt


File fix.txt, 1.5 KB (added by aheckmann, May 31, 2009 06:35PM UTC)

The fix

// **  original line 3180
jQuery.extend({
	style: function( elem, name, value ) {
		// don't set styles on text and comment nodes
		if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
			return undefined;

		var style = elem.style || elem, set = value !== undefined;

		// IE uses filters for opacity
		if ( !jQuery.support.opacity && name == "opacity" ) {
			if ( set ) {
				// IE has trouble with opacity if it does not have layout
				// Force it by setting the zoom level
				style.zoom = 1;

				// Set the alpha filter to set the opacity
				style.filter = (style.filter || "").replace( /alpha\([^)]*\)/, "" ) +
					(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
			}


// *****************	
// **  fixed
jQuery.extend({
	style: function( elem, name, value ) {
		// don't set styles on text and comment nodes
		if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
			return undefined;

		var style = elem.style || elem, set = value !== undefined;

		// IE uses filters for opacity
		if ( !jQuery.support.opacity && name == "opacity" ) {
			if ( set ) {
				// IE has trouble with opacity if it does not have layout
				// Force it by setting the zoom level
				style.zoom = 1;

				// Set the alpha filter to set the opacity
				var opacity = (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"),
					filter = (style.filter || jQuery.curCSS( elem, 'filter' ) || "");
				
				style.filter = /alpha\([^)]*\)/.test(filter) ?
					filter.replace( /alpha\([^)]*\)/, opacity) :
					opacity;
			}

Download in other formats:

Original Format