]> source.dussan.org Git - jquery-ui.git/commitdiff
Selectmenu: Remove links in menu items
authorFelix Nagel <info@felixnagel.com>
Wed, 9 Oct 2013 23:01:41 +0000 (01:01 +0200)
committerFelix Nagel <info@felixnagel.com>
Wed, 9 Oct 2013 23:01:41 +0000 (01:01 +0200)
tests/unit/selectmenu/selectmenu_core.js
tests/unit/selectmenu/selectmenu_events.js
themes/base/jquery.ui.selectmenu.css
ui/jquery.ui.selectmenu.js

index d8b4498288e9ebda699552779cd7083dbcabbf71..60c350eb30ad5201f31a0fd20685a57f45cc437a 100644 (file)
@@ -9,7 +9,7 @@ asyncTest( "accessibility", function() {
                menu = element.selectmenu( "menuWidget" );
 
        button.simulate( "focus" );
-       links = menu.find( "li.ui-menu-item a" );
+       links = menu.find( "li.ui-menu-item" );
 
        expect( 12 + links.length * 2 );
 
@@ -65,7 +65,7 @@ $.each([
 
                button.simulate( "focus" );
                setTimeout(function() {
-                       links = menu.find("li.ui-menu-item a");
+                       links = menu.find("li.ui-menu-item");
 
                        button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
                        equal(
@@ -98,10 +98,10 @@ $.each([
 
                button.simulate( "focus" );
                setTimeout(function() {
-                       links = menu.find("li.ui-menu-item a");
+                       links = menu.find("li.ui-menu-item");
 
                        button.trigger( "click" );
-                       menu.find( "a" ).last().simulate( "mouseover" ).trigger( "click" );
+                       menu.find( "li" ).last().simulate( "mouseover" ).trigger( "click" );
                        equal(
                                menu.attr( "aria-activedescendant" ),
                                links.eq( element[ 0 ].selectedIndex ).attr( "id" ),
@@ -135,7 +135,7 @@ $.each([
                button.simulate( "focus" );
 
                setTimeout(function() {
-                       links = menu.find( "li.ui-menu-item a" );
+                       links = menu.find( "li.ui-menu-item" );
                        // open menu and click first item
                        button.trigger( "click" );
                        links.first().simulate( "mouseover" ).trigger( "click" );
@@ -169,7 +169,7 @@ $.each([
                button.simulate( "focus" );
 
                setTimeout(function() {
-                       links = menu.find( "li.ui-menu-item a" );
+                       links = menu.find( "li.ui-menu-item" );
 
                        button.trigger( "click" );
                        links.first().simulate( "mouseover" ).trigger( "click" );
@@ -196,7 +196,7 @@ $.each([
                button.simulate( "focus" );
 
                setTimeout(function() {
-                       links = menu.find( "li.ui-menu-item a" );
+                       links = menu.find( "li.ui-menu-item" );
 
                        button.trigger( "click" );
                        setTimeout(function() {
@@ -221,11 +221,11 @@ $.each([
                }, 1 );
 
                function checkItemClasses() {
-                       focusedItem = menu.find( "li.ui-menu-item a.ui-state-focus" );
+                       focusedItem = menu.find( "li.ui-state-focus" );
                        equal( focusedItem.length, 1, "only one item has ui-state-focus class" );
                        equal( focusedItem.attr( "id" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "selected item has ui-state-focus class" );
 
-                       activeItem = menu.find( "li.ui-menu-item a.ui-state-active" );
+                       activeItem = menu.find( "li.ui-state-active" );
                        equal( activeItem.length, 1, "only one item has ui-state-active class" );
                        equal( activeItem.attr( "id" ), links.eq( element[ 0 ].selectedIndex ).attr( "id" ), "selected item has ui-state-active class" );
                }
index 353780ee5308c4cc77a48655d3509eabe20311e4..182c0cd1b9809d1f752fad2596ab90901bf00901 100644 (file)
@@ -30,7 +30,7 @@ asyncTest( "change", function () {
 
        setTimeout(function() {
                button.trigger( "click" );
-               menu.find( "a" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" );
+               menu.find( "li" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" );
                start();
        }, 1 );
 });
@@ -79,7 +79,7 @@ asyncTest( "focus", function () {
                button.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
 
                button.trigger( "click" );
-               links = menu.find( "li.ui-menu-item a" );
+               links = menu.find( "li.ui-menu-item" );
                optionIndex = 0;
                links.eq( optionIndex ).simulate( "mouseover" );
                optionIndex += 1;
@@ -127,7 +127,7 @@ asyncTest( "select", function () {
 
        setTimeout(function() {
                button.trigger( "click" );
-               menu.find( "a" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" );
+               menu.find( "li" ).eq( optionIndex ).simulate( "mouseover" ).trigger( "click" );
                start();
        }, 1 );
 });
index c941ef0b13c1683ca1eea858a68956e218147579..804f96cfb3a57e0f4277ab9a34338dc43c466d2e 100644 (file)
@@ -21,7 +21,7 @@
        /* Support: IE7 */
        overflow-x: hidden;
 }
-.ui-selectmenu-menu .ui-menu-item {
+.ui-selectmenu-menu .ui-menu-item {
        padding: 0.3em 1em;
 }
 .ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup {
index 7d7c3fb9855faf9fd7768df5ba3af9200facc0c1..90dfce824487fbd9c4b0c3535a04bfae89e76e7b 100644 (file)
@@ -176,7 +176,7 @@ $.widget( "ui.selectmenu", {
                this._renderMenu( this.menu, this.items );
 
                this.menuInstance.refresh();
-               this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).find( "a" );
+               this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
 
                item = this._getSelectedItem();
 
@@ -250,7 +250,7 @@ $.widget( "ui.selectmenu", {
                $.each( items, function( index, item ) {
                        if ( item.optgroup !== currentOptgroup ) {
                                $( "<li>", {
-                                       "class": "ui-selectmenu-optgroup" +
+                                       "class": "ui-selectmenu-optgroup ui-menu-divider" +
                                                ( item.element.parent( "optgroup" ).attr( "disabled" ) ?
                                                        " ui-state-disabled" :
                                                        "" ),
@@ -268,15 +268,14 @@ $.widget( "ui.selectmenu", {
        },
 
        _renderItem: function( ul, item ) {
-               var li = $( "<li>" ),
-                       a = $( "<a>", { href: "#" });
+               var li = $( "<li>" );
 
                if ( item.disabled ) {
                        li.addClass( "ui-state-disabled" );
                }
-               this._setText( a, item.label );
+               this._setText( li, item.label );
 
-               return li.append( a ).appendTo( ul );
+               return li.appendTo( ul );
        },
 
        _setText: function( element, value ) {
@@ -303,7 +302,7 @@ $.widget( "ui.selectmenu", {
        },
 
        _getSelectedItem: function() {
-               return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
+               return this.menuItems.eq( this.element[ 0 ].selectedIndex );
        },
 
        _toggle: function( event ) {
@@ -407,8 +406,7 @@ $.widget( "ui.selectmenu", {
        },
 
        _setAria: function( item ) {
-               var link = this.menuItems.eq( item.index ),
-                       id = link.attr( "id" );
+               var id = this.menuItems.eq( item.index ).attr( "id" );
 
                this.button.attr({
                        "aria-labelledby": id,