mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
parent
0d25a36eec
commit
adcf9b6f6e
@ -142,7 +142,7 @@ QUnit.test( "uniqueId / removeUniqueId", function( assert ) {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( "Labels", function( assert ) {
|
QUnit.test( "Labels", function( assert ) {
|
||||||
assert.expect( 2 );
|
assert.expect( 3 );
|
||||||
|
|
||||||
var expected = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ];
|
var expected = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ];
|
||||||
var dom = $( "#labels-fragment" );
|
var dom = $( "#labels-fragment" );
|
||||||
@ -165,6 +165,8 @@ QUnit.test( "Labels", function( assert ) {
|
|||||||
// Detach the dom to test on a fragment
|
// Detach the dom to test on a fragment
|
||||||
dom.detach();
|
dom.detach();
|
||||||
testLabels( "document fragments" );
|
testLabels( "document fragments" );
|
||||||
|
|
||||||
|
assert.equal( $().labels().length, 0, "No element" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
( function() {
|
( function() {
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
return $.fn.labels = function() {
|
return $.fn.labels = function() {
|
||||||
var ancestor, selector, id, labels, ancestors;
|
var ancestor, selector, id, labels, ancestors;
|
||||||
|
|
||||||
|
if ( !this.length ) {
|
||||||
|
return this.pushStack( [] );
|
||||||
|
}
|
||||||
|
|
||||||
// Check control.labels first
|
// Check control.labels first
|
||||||
if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
|
if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
|
||||||
return this.pushStack( this[ 0 ].labels );
|
return this.pushStack( this[ 0 ].labels );
|
||||||
|
Loading…
Reference in New Issue
Block a user