mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Ref #8908. Update IE9 css clone fix. Close gh-1119.
This commit is contained in:
parent
9434060722
commit
054daa20af
@ -216,18 +216,13 @@ jQuery.extend({
|
|||||||
|
|
||||||
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
|
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
|
||||||
// but it would mean to define eight (for every problematic property) identical functions
|
// but it would mean to define eight (for every problematic property) identical functions
|
||||||
if ( value === "" && name.indexOf("background") === 0 ) {
|
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
|
||||||
value = " ";
|
style[ name ] = "inherit";
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a hook was provided, use that value, otherwise just set the specified value
|
// 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 ) {
|
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
|
|
||||||
try {
|
|
||||||
style[ name ] = value;
|
style[ name ] = value;
|
||||||
} catch(e) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -64,6 +64,10 @@ jQuery.support = (function() {
|
|||||||
div.setAttribute( "onfocusin", "t" );
|
div.setAttribute( "onfocusin", "t" );
|
||||||
support.focusinBubbles = "onfocusin" in window || div.attributes.onfocusin.expando === false;
|
support.focusinBubbles = "onfocusin" in window || div.attributes.onfocusin.expando === false;
|
||||||
|
|
||||||
|
div.style.backgroundClip = "content-box";
|
||||||
|
div.cloneNode().style.backgroundClip = "";
|
||||||
|
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
||||||
|
|
||||||
// Run tests that need a body at doc ready
|
// Run tests that need a body at doc ready
|
||||||
jQuery(function() {
|
jQuery(function() {
|
||||||
var container, marginDiv, tds,
|
var container, marginDiv, tds,
|
||||||
|
@ -883,7 +883,7 @@ test( "css opacity consistency across browsers (#12685)", function() {
|
|||||||
equal( Math.round( el.css("opacity") * 100 ), 20, "remove opacity override" );
|
equal( Math.round( el.css("opacity") * 100 ), 20, "remove opacity override" );
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", 16, function() {
|
asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", 24, function() {
|
||||||
var baseUrl = document.location.href.replace( /([^\/]*)$/, "" ),
|
var baseUrl = document.location.href.replace( /([^\/]*)$/, "" ),
|
||||||
styles = [{
|
styles = [{
|
||||||
name: "backgroundAttachment",
|
name: "backgroundAttachment",
|
||||||
@ -921,7 +921,7 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
|
|||||||
expected: [ "auto auto" ]
|
expected: [ "auto auto" ]
|
||||||
}];
|
}];
|
||||||
|
|
||||||
jQuery.each( styles, function(index, style) {
|
jQuery.each(styles, function( index, style ) {
|
||||||
var $clone, $clonedChildren,
|
var $clone, $clonedChildren,
|
||||||
$source = jQuery( "#firstp" ),
|
$source = jQuery( "#firstp" ),
|
||||||
source = $source[ 0 ],
|
source = $source[ 0 ],
|
||||||
@ -932,6 +932,7 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
|
|||||||
if ( source.style[ style.name ] === undefined ) {
|
if ( source.style[ style.name ] === undefined ) {
|
||||||
ok( true, style.name + ": style isn't supported and therefore not an issue" );
|
ok( true, style.name + ": style isn't supported and therefore not an issue" );
|
||||||
ok( true );
|
ok( true );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -945,6 +946,8 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
|
|||||||
$clonedChildren.css( style.name, "" );
|
$clonedChildren.css( style.name, "" );
|
||||||
|
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
|
notEqual( $clone.css( style.name ), style.value[ 0 ], "Cloned css was changed" );
|
||||||
|
|
||||||
ok( jQuery.inArray( $source.css( style.name ) !== -1, style.value ),
|
ok( jQuery.inArray( $source.css( style.name ) !== -1, style.value ),
|
||||||
"Clearing clone.css() doesn't affect source.css(): " + style.name +
|
"Clearing clone.css() doesn't affect source.css(): " + style.name +
|
||||||
"; result: " + $source.css( style.name ) +
|
"; result: " + $source.css( style.name ) +
|
||||||
|
Loading…
Reference in New Issue
Block a user