Skip to content

Instantly share code, notes, and snippets.

@gibson042
Last active August 29, 2015 14:01
Show Gist options
  • Save gibson042/03bd6ecd8cfefeaaa9ae to your computer and use it in GitHub Desktop.
Save gibson042/03bd6ecd8cfefeaaa9ae to your computer and use it in GitHub Desktop.
jQuery #15098 remote src
// http://bugs.jquery.com/ticket/15098
(function( window ) {
var getStyles, curCSS;
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
};
curCSS = function( elem, name, computed ) {
var ret;
computed = computed || getStyles( elem );
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
if ( computed ) {
if ( ret === "dummy-block" ) {
ret = elem[ name ];
}
}
return ret;
};
}
window.simpleCSS = function( elem, name, extra, styles ) {
var val;
name = name in elem.style ? name : "Moz" + name.charAt(0).toUpperCase() + name.slice(1);
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
if ( val === "dummy-block" ) {
val = curCSS[ val ];
}
return val;
};
})( typeof window !== "undefined" ? window : this );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment