diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 2f365760512..a0d0a2de12f 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -127,11 +127,11 @@ test( "outerHeight(true) - setter", function() { test( "uniqueId / removeUniqueId", function() { expect( 3 ); var el = $( "img" ).eq( 0 ); - strictEqual( el.attr( "id" ), undefined, "element has no initial id" ); + equal( el.attr( "id" ), null, "element has no initial id" ); el.uniqueId(); ok( /ui-id-\d+$/.test( el.attr( "id" ) ), "element has generated id" ); el.removeUniqueId(); - strictEqual( el.attr( "id" ), undefined, "unique id has been removed from element" ); + equal( el.attr( "id" ), null, "unique id has been removed from element" ); }); })( jQuery ); diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index f600722fc2f..73d24fed0af 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -78,7 +78,7 @@ test( "ARIA", function() { element.remove(); element = $("

descriotion

").dialog(); - strictEqual( element.dialog( "widget" ).attr( "aria-describedby" ), undefined, "no aria-describedby added, as already present in markup" ); + equal( element.dialog( "widget" ).attr( "aria-describedby" ), null, "no aria-describedby added, as already present in markup" ); element.remove(); }); diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js index 39ba62e3c2c..3df5473348d 100644 --- a/tests/unit/menu/menu_options.js +++ b/tests/unit/menu/menu_options.js @@ -107,11 +107,11 @@ test( "{ role: null }", function( assert ) { }), items = element.find( "li" ); expect( 2 + 3 * items.length ); - strictEqual( element.attr( "role" ), undefined ); + equal( element.attr( "role" ), null ); ok( items.length > 0, "number of menu items" ); items.each(function( item ) { assert.hasClasses( $( this ), "ui-menu-item" ); - equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "role" ), undefined, + equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "role" ), null, "menu item ("+ item + ") role" ); equal( $( this ).find( ".ui-menu-item-wrapper" ).attr( "tabindex" ), "-1", "tabindex for menu item ("+ item + ")" ); diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js index 686e93b432b..60ff3141128 100644 --- a/tests/unit/progressbar/progressbar_core.js +++ b/tests/unit/progressbar/progressbar_core.js @@ -55,7 +55,7 @@ test( "accessibility", function() { element.progressbar( "option", "value", false ); equal( element.attr( "aria-valuemin" ), 0, "aria-valuemin" ); equal( element.attr( "aria-valuemax" ), 150, "aria-valuemax" ); - strictEqual( element.attr( "aria-valuenow" ), undefined, "aria-valuenow" ); + equal( element.attr( "aria-valuenow" ), null, "aria-valuenow" ); }); }( jQuery ) ); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 175fadd971f..e03fd8f67a8 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -305,11 +305,11 @@ window.domEqual = function( selector, modifier, message ) { result = {}; $.each( properties, function( index, attr ) { var value = elem.prop( attr ); - result[ attr ] = value !== undefined ? value : ""; + result[ attr ] = value != null ? value : ""; }); $.each( attributes, function( index, attr ) { var value = elem.attr( attr ); - result[ attr ] = value !== undefined ? value : ""; + result[ attr ] = value != null ? value : ""; }); result.style = getElementStyles( elem[ 0 ] ); result.events = $._data( elem[ 0 ], "events" ); diff --git a/tests/unit/tooltip/tooltip_core.js b/tests/unit/tooltip/tooltip_core.js index 10ebb2829bb..d4520a4ea68 100644 --- a/tests/unit/tooltip/tooltip_core.js +++ b/tests/unit/tooltip/tooltip_core.js @@ -38,8 +38,7 @@ test( "accessibility", function() { equal( element.attr( "aria-describedby" ), "fixture-span " + tooltipId, "multiple describedby when open" ); - // strictEqual to distinguish between .removeAttr( "title" ) and .attr( "title", "" ) - strictEqual( element.attr( "title" ), undefined, "no title when open" ); + equal( element.attr( "title" ), null, "no title when open" ); equal( liveRegion.children().length, 1 ); equal( liveRegion.children().last().html(), "..." ); element.tooltip( "close" ); diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js index ea69216d097..f027d522620 100644 --- a/tests/unit/tooltip/tooltip_methods.js +++ b/tests/unit/tooltip/tooltip_methods.js @@ -70,7 +70,7 @@ test( "enable/disable", function( assert ) { assert.lacksClasses( element.tooltip( "widget" ), "ui-state-disabled" ); ok( !element.tooltip( "widget" ).attr( "aria-disabled" ), "element doesn't get aria-disabled" ); assert.lacksClasses( element.tooltip( "widget" ), "ui-tooltip-disabled" ); - strictEqual( tooltip.attr( "title" ), undefined, "title removed on disable" ); + equal( tooltip.attr( "title" ), null, "title removed on disable" ); element.tooltip( "open" ); equal( $( ".ui-tooltip" ).length, 0, "open does nothing when disabled" ); diff --git a/ui/core.js b/ui/core.js index eaf11d0a82b..465c5b85d39 100644 --- a/ui/core.js +++ b/ui/core.js @@ -116,7 +116,7 @@ $.fn.extend( { } ); // selectors -function focusable( element, isTabIndexNotNaN ) { +function focusable( element, hasTabindex ) { var map, mapName, img, nodeName = element.nodeName.toLowerCase(); if ( "area" === nodeName ) { @@ -131,8 +131,8 @@ function focusable( element, isTabIndexNotNaN ) { return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ? !element.disabled : "a" === nodeName ? - element.href || isTabIndexNotNaN : - isTabIndexNotNaN ) && + element.href || hasTabindex : + hasTabindex ) && // the element and all of its ancestors must be visible visible( element ); } @@ -157,13 +157,13 @@ $.extend( $.expr[ ":" ], { }, focusable: function( element ) { - return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); + return focusable( element, $.attr( element, "tabindex" ) != null ); }, tabbable: function( element ) { var tabIndex = $.attr( element, "tabindex" ), - isTabIndexNaN = isNaN( tabIndex ); - return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); + hasTabindex = tabIndex != null; + return ( !hasTabindex || tabIndex >= 0 ) && focusable( element, hasTabindex ); } } ); diff --git a/ui/dialog.js b/ui/dialog.js index 2f322aa866d..c7ffbd9efd7 100644 --- a/ui/dialog.js +++ b/ui/dialog.js @@ -118,7 +118,9 @@ $.widget( "ui.dialog", { index: this.element.parent().children().index( this.element ) }; this.originalTitle = this.element.attr( "title" ); - this.options.title = this.options.title || this.originalTitle; + if ( this.options.title == null && this.originalTitle != null ) { + this.options.title = this.originalTitle; + } this._createWrapper(); @@ -433,10 +435,11 @@ $.widget( "ui.dialog", { }, _title: function( title ) { - if ( !this.options.title ) { + if ( this.options.title ) { + title.text( this.options.title ); + } else { title.html( " " ); } - title.text( this.options.title ); }, _createButtonPane: function() { diff --git a/ui/spinner.js b/ui/spinner.js index 870b2cd8935..9a08208c11d 100644 --- a/ui/spinner.js +++ b/ui/spinner.js @@ -105,7 +105,7 @@ return $.widget( "ui.spinner", { $.each( [ "min", "max", "step" ], function( i, option ) { var value = element.attr( option ); - if ( value !== undefined && value.length ) { + if ( value != null && value.length ) { options[ option ] = value; } } );