Skip to content

Commit f6ae2cb

Browse files
committed
Revert "Test: Don't attach elements to body"
This reverts commit 24dcb86.
1 parent ac020a1 commit f6ae2cb

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

jquery.color.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ color.hook = function( hook ) {
640640
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
641641
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
642642
while (
643-
(backgroundColor === "" || backgroundColor === "transparent") &&
643+
( backgroundColor === "" || backgroundColor === "transparent" ) &&
644644
curElem && curElem.style
645645
) {
646646
try {
@@ -659,7 +659,8 @@ color.hook = function( hook ) {
659659
}
660660
try {
661661
elem.style[ hook ] = value;
662-
} catch( e ) {
662+
} catch ( e ) {
663+
663664
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
664665
}
665666
}

test/unit/color.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ QUnit.test( "jQuery.Color({ red: 10, green: 20, blue: 30, alpha: 0.4 })", functi
4949
} );
5050

5151
QUnit.test( "jQuery.Color( element, \"color\" )", function( assert ) {
52-
var $div = jQuery( "<div>" ).css( "color", "#fff" );
52+
var $div = jQuery( "<div>" ).appendTo( "body" ).css( "color", "#fff" );
5353
assert.expect( 8 );
5454
testParts( jQuery.Color( $div, "color" ), {
5555
prefix: "jQuery(<div>): ",
@@ -65,6 +65,7 @@ QUnit.test( "jQuery.Color( element, \"color\" )", function( assert ) {
6565
blue: 255,
6666
alpha: 1
6767
}, assert );
68+
$div.remove();
6869
} );
6970

7071
parseTest( jQuery.Color( { red: 100 } ), {
@@ -616,7 +617,7 @@ QUnit.test( "animated", function( assert ) {
616617
assert.expect( 8 );
617618

618619
var done = assert.async(),
619-
el = jQuery( "<div></div>" ).css( { color: "#000000" } );
620+
el = jQuery( "<div></div>" ).appendTo( "body" ).css( { color: "#000000" } );
620621

621622
el.animate( { color: "#ffffff" }, 1, function() {
622623
testParts( jQuery.Color( el, "color" ), {
@@ -636,6 +637,7 @@ QUnit.test( "animated", function( assert ) {
636637
alpha: 1
637638
}, assert );
638639

640+
el.remove();
639641
done();
640642
} );
641643
} );
@@ -653,20 +655,20 @@ QUnit.test( "animated documentFragment", function( assert ) {
653655
} );
654656

655657
QUnit.test( "Setting CSS to empty string / inherit", function( assert ) {
656-
var el = jQuery( "<div></div>" ).css( { color: "#fff" } );
658+
var el = jQuery( "<div></div>" ).appendTo( "body" ).css( { color: "#fff" } );
657659
assert.expect( 2 );
658660

659661
el.css( "color", "" );
660662
assert.equal( el[ 0 ].style.color, "", "CSS was set to empty string" );
661663

662664
el.css( "color", "inherit" );
663-
assert.ok( el[ 0 ].style.color === "inherit", "Setting CSS to inherit didn't throw error" );
665+
assert.ok( el[ 0 ].style.color === "" || el[ 0 ].style.color === "inherit", "Setting CSS to inherit didn't throw error" );
664666
} );
665667

666668
QUnit.test( "Setting CSS to transparent", function( assert ) {
667669
assert.expect( 1 );
668670

669-
var parentEl = jQuery( "<div></div>" ).css( { backgroundColor: "blue" } ),
671+
var parentEl = jQuery( "<div></div>" ).appendTo( "body" ).css( { backgroundColor: "blue" } ),
670672
el = jQuery( "<div></div>" ).appendTo( parentEl );
671673

672674
el.css( "backgroundColor", "transparent" );

0 commit comments

Comments
 (0)