diff --git a/src/css.js b/src/css.js index 79127ec0e5..30342a230d 100644 --- a/src/css.js +++ b/src/css.js @@ -286,6 +286,9 @@ jQuery.extend({ // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + // Support: Chrome, Safari + // Setting style to blank string required to delete "style: x !important;" + style[ name ] = ""; style[ name ] = value; } diff --git a/test/unit/css.js b/test/unit/css.js index 2c9fae0e73..4c1a9a2417 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -925,6 +925,12 @@ test( ":visible/:hidden selectors", function() { t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] ); }); +test( "Override !important when changing styles (#14394)", function() { + expect( 1 ); + var el = jQuery( "
" ).css( "display", "none" ); + equal( el.css( "display" ), "none", "New style replaced !important" ); +}); + asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", 24, function() { var baseUrl = document.location.href.replace( /([^\/]*)$/, "" ), styles = [{