mirror of
https://github.com/jquery/jquery.git
synced 2026-02-06 18:14:55 -05:00
Add support check, added assertion to check if cleared, add edge case for backgroundPosition
This commit is contained in:
@@ -204,6 +204,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 ) {
|
||||
// IE9/10 Clearing Cloned Style Clear's Original Style. Fixes bug #8908
|
||||
value = !jQuery.support.clearCloneStyle && value === "" && name.match( /backgroundPosition/ ) ? "0% 0%" : value;
|
||||
|
||||
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
|
||||
// Fixes bug #5509
|
||||
try {
|
||||
|
||||
@@ -585,14 +585,13 @@ jQuery.extend({
|
||||
var srcElements,
|
||||
destElements,
|
||||
i,
|
||||
clone,
|
||||
fix8908;
|
||||
clone;
|
||||
|
||||
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
|
||||
// Fixes #8909 - By accessing one of the element's computed styles it breaks the
|
||||
// connection with the cloned element's styles in IE9/10
|
||||
if ( elem.nodeType === 1 && window.getComputedStyle ) {
|
||||
fix8908 = ( window.getComputedStyle( elem, null ) || {} ).backgroundImage;
|
||||
if ( !jQuery.support.clearCloneStyle && elem.nodeType === 1 && window.getComputedStyle ) {
|
||||
i = ( window.getComputedStyle( elem, null ) || {} ).backgroundPosition;
|
||||
}
|
||||
|
||||
clone = elem.cloneNode( true );
|
||||
|
||||
@@ -170,6 +170,19 @@ jQuery.support = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
support.clearCloneStyle = (function() {
|
||||
var source = document.createElement( "div" ),
|
||||
styleName = "backgroundClip",
|
||||
value = "content-box",
|
||||
clone;
|
||||
|
||||
source.style[ styleName ] = value;
|
||||
clone = source.cloneNode( true );
|
||||
clone.style[ styleName ] = "";
|
||||
|
||||
return source.style[ styleName ] === value;
|
||||
})();
|
||||
|
||||
// Run tests that need a body at doc ready
|
||||
jQuery(function() {
|
||||
var container, div, tds, marginDiv,
|
||||
|
||||
Reference in New Issue
Block a user