Showing with 21 additions and 5 deletions.
  1. +10 −3 Gruntfile.js
  2. +5 −2 src/css.js
  3. +6 −0 test/unit/css.js
@@ -111,10 +111,17 @@ module.exports = function( grunt ) {
ascii_only: true
},
compress: {
hoist_funs: false,
join_vars: false,
properties: true,
dead_code: true,
unsafe: false,
booleans: true,
loops: false,
unused: false
unused: false,
hoist_funs: false,
hoist_vars: false,
if_return: true,
join_vars: true,
warnings: true
}
}
}
@@ -292,9 +292,12 @@ 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 ) {

// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
// Support: IE
// Swallow errors from 'invalid' CSS values (#5509)
try {
// Support: Chrome, Safari
// Setting style to blank string required to delete "style: x !important;"
style[ name ] = "";
style[ name ] = value;
} catch(e) {}
}
@@ -970,6 +970,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( "<div style='display: block !important;'></div>" ).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 = [{