Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

2.0: Re-fix #8908 #1119

Closed
wants to merge 3 commits into from

3 participants

Oleg Gaidarenko Markus Staab Dave Methvin
Oleg Gaidarenko
Collaborator

No description provided.

src/css.js
((10 lines not shown))
// 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
try {
+
Markus Staab
staabm added a note

Should this block be moved outside of the try-catch to make it as small as possible..?

Oleg Gaidarenko Collaborator
markelog added a note

if it can be, then try-catch could be removed, apparently, it can be, but that is another story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Dave Methvin dmethvin closed this in 054daa2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 7, 2013
  1. Oleg Gaidarenko

    Re-fix #8908

    markelog authored
  2. Oleg Gaidarenko

    Move patch from try-catch

    markelog authored
  3. Oleg Gaidarenko

    Remove fix for #5509

    markelog authored
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 10 deletions.
  1. +3 −8 src/css.js
  2. +4 −0 src/support.js
  3. +5 −2 test/unit/css.js
11 src/css.js
View
@@ -216,18 +216,13 @@ jQuery.extend({
// 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
- if ( value === "" && name.indexOf("background") === 0 ) {
- value = " ";
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ style[ name ] = "inherit";
}
// 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
- try {
- style[ name ] = value;
- } catch(e) {}
+ style[ name ] = value;
}
} else {
4 src/support.js
View
@@ -64,6 +64,10 @@ jQuery.support = (function() {
div.setAttribute( "onfocusin", "t" );
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
jQuery(function() {
var container, marginDiv, tds,
7 test/unit/css.js
View
@@ -883,7 +883,7 @@ test( "css opacity consistency across browsers (#12685)", function() {
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( /([^\/]*)$/, "" ),
styles = [{
name: "backgroundAttachment",
@@ -921,7 +921,7 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
expected: [ "auto auto" ]
}];
- jQuery.each( styles, function(index, style) {
+ jQuery.each(styles, function( index, style ) {
var $clone, $clonedChildren,
$source = jQuery( "#firstp" ),
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 ) {
ok( true, style.name + ": style isn't supported and therefore not an issue" );
ok( true );
+
return true;
}
@@ -945,6 +946,8 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme
$clonedChildren.css( style.name, "" );
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 ),
"Clearing clone.css() doesn't affect source.css(): " + style.name +
"; result: " + $source.css( style.name ) +
Something went wrong with that request. Please try again.