Skip to content

Commit

Permalink
Make sure the currentStyle property exists before attempting to acces…
Browse files Browse the repository at this point in the history
…s it.
  • Loading branch information
jeresig committed Sep 27, 2010
1 parent 88fc523 commit 6dd2dc4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/css.js
Expand Up @@ -174,7 +174,7 @@ if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test((computed ? elem.currentStyle.filter : elem.style.filter) || "") ?
return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
(parseFloat(RegExp.$1) / 100) + "" :
"1";
},
Expand All @@ -191,7 +191,7 @@ if ( !jQuery.support.opacity ) {
"" :
"alpha(opacity=" + value * 100 + ")";

var filter = style.filter || elem.currentStyle.filter || "";
var filter = style.filter || elem.currentStyle && elem.currentStyle.filter || "";

style.filter = ralpha.test(filter) ?
filter.replace(ralpha, opacity) :
Expand Down Expand Up @@ -219,7 +219,7 @@ if ( getComputedStyle ) {

} else if ( document.documentElement.currentStyle ) {
curCSS = function( elem, name ) {
var left, rsLeft, ret = elem.currentStyle[ name ], style = elem.style;
var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style;

// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
Expand Down

0 comments on commit 6dd2dc4

Please sign in to comment.