From ecd8ea4a1c40b6056381e920dd03add3db52d4dd Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Fri, 2 Sep 2011 00:21:09 +0200 Subject: [PATCH 001/386] Selectmenu: basic implementation --- demos/selectmenu/default.html | 67 ++++++ demos/selectmenu/index.html | 16 ++ themes/base/jquery.ui.base.css | 1 + themes/base/jquery.ui.selectmenu.css | 16 ++ ui/jquery.ui.selectmenu.js | 300 +++++++++++++++++++++++++++ 5 files changed, 400 insertions(+) create mode 100644 demos/selectmenu/default.html create mode 100644 demos/selectmenu/index.html create mode 100644 themes/base/jquery.ui.selectmenu.css create mode 100644 ui/jquery.ui.selectmenu.js diff --git a/demos/selectmenu/default.html b/demos/selectmenu/default.html new file mode 100644 index 000000000..e1b4517c3 --- /dev/null +++ b/demos/selectmenu/default.html @@ -0,0 +1,67 @@ + + + + + jQuery UI Selectmenu - Default functionality + + + + + + + + + + + + + + +
+ +
+
+ + +
+
+
+ + +
+
+ +
+ + + +
+

The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.

+

The datasource is a simple JavaScript array, provided to the widget using the source-option.

+
+ + + diff --git a/demos/selectmenu/index.html b/demos/selectmenu/index.html new file mode 100644 index 000000000..909c3e262 --- /dev/null +++ b/demos/selectmenu/index.html @@ -0,0 +1,16 @@ + + + + + jQuery UI Selectmenu Demos + + + +
+

Examples

+ +
+ + diff --git a/themes/base/jquery.ui.base.css b/themes/base/jquery.ui.base.css index a359c2ba4..6973ff0f0 100644 --- a/themes/base/jquery.ui.base.css +++ b/themes/base/jquery.ui.base.css @@ -19,6 +19,7 @@ @import url("jquery.ui.progressbar.css"); @import url("jquery.ui.resizable.css"); @import url("jquery.ui.selectable.css"); +@import url("jquery.ui.selectmenu.css"); @import url("jquery.ui.slider.css"); @import url("jquery.ui.spinner.css"); @import url("jquery.ui.tabs.css"); diff --git a/themes/base/jquery.ui.selectmenu.css b/themes/base/jquery.ui.selectmenu.css new file mode 100644 index 000000000..d64084d60 --- /dev/null +++ b/themes/base/jquery.ui.selectmenu.css @@ -0,0 +1,16 @@ +/* + * jQuery UI Selectmenu @VERSION + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectmenu#theming + */ + +.ui-selectmenu-menu { padding: 0; margin: 0; position:absolute; top: 0; display: none; } +.ui-selectmenu-menu .ui-menu { padding: 0; } +.ui-selectmenu-open { display: block; } + +.ui-button span.ui-icon { right: 0.5em; left: auto; } +.ui-button span.ui-button-text { text-align: left; padding: 0.4em 2.1em 0.4em 1em } \ No newline at end of file diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js new file mode 100644 index 000000000..c8ee50a75 --- /dev/null +++ b/ui/jquery.ui.selectmenu.js @@ -0,0 +1,300 @@ +/* + * jQuery UI Selectmenu @VERSION + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectmenu + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.position.js + * jquery.ui.menu.js + */ +(function( $, undefined ) { + +// used to prevent race conditions with remote data sources +var requestIndex = 0; + +$.widget( "ui.selectmenu", { + version: "@VERSION", + defaultElement: "", options: { + dropdown: true, wrapperElement: "
", appendTo: "body", position: { @@ -65,18 +66,21 @@ $.widget( "ui.selectmenu", { // create button self.newelement = $( '', { href: '#' + selectmenuId, - tabindex: (tabindex ? tabindex : self.element.attr( 'disabled' ) ? 1 : 0), + tabindex: ( tabindex ? tabindex : self.element.attr( 'disabled' ) ? 1 : 0 ), 'aria-haspopup': true, 'aria-owns': self.ids[ 1 ], css: { width: self.element.width() } - }).button({ + }) + .addClass( self.widgetBaseClass + '-button' ) + .button({ label: self.items.eq( self.element[0].selectedIndex ).text(), icons: { - primary: "ui-icon-triangle-2-n-s" + primary: ( options.dropdown ? 'ui-icon-triangle-1-s' : 'ui-icon-triangle-2-n-s' ) } }); + self.newelementWrap = $( options.wrapperElement ) .append( self.newelement ) .insertAfter( self.element ); @@ -130,8 +134,7 @@ $.widget( "ui.selectmenu", { } return ret; }); - - + // create menu portion, append to body self.list = $( '
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 3b6f84946..50f1264e5 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -333,7 +333,7 @@ $.widget( "ui.selectmenu", { event.stopImmediatePropagation(); }, click: function( event ) { - // needed to prevent browser from following the anchor + // return false needed to prevent browser from following the anchor return false; }, keydown: function( event ) { @@ -342,8 +342,10 @@ $.widget( "ui.selectmenu", { if ( this.opened ) this.close(); break; case $.ui.keyCode.ENTER: - if ( this.opened ) this.list.menu( "select", this._getSelectedItem() ); - event.preventDefault(); + if ( this.opened ) { + this.list.menu( "select", this._getSelectedItem() ); + event.preventDefault(); + } break; case $.ui.keyCode.SPACE: this._toggle(event); @@ -377,8 +379,7 @@ $.widget( "ui.selectmenu", { this.list.trigger( event ); } } - }, - + }, _setOption: function( key, value ) { this._super( "_setOption", key, value ); From d83f0b2de94ea3b2bbf63a8abdfdeadeea8956cd Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Wed, 5 Oct 2011 00:47:38 +0200 Subject: [PATCH 032/386] Selectmenu: changed button to inline element --- demos/selectmenu/default.html | 1 + tests/visual/selectmenu/disabled.html | 1 + tests/visual/selectmenu/events.html | 1 + tests/visual/selectmenu/option.html | 1 + ui/jquery.ui.selectmenu.js | 2 +- 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/demos/selectmenu/default.html b/demos/selectmenu/default.html index 8e4c7556e..d8296dedb 100644 --- a/demos/selectmenu/default.html +++ b/demos/selectmenu/default.html @@ -29,6 +29,7 @@ diff --git a/tests/visual/selectmenu/disabled.html b/tests/visual/selectmenu/disabled.html index a76cc7001..b7861f6c8 100644 --- a/tests/visual/selectmenu/disabled.html +++ b/tests/visual/selectmenu/disabled.html @@ -50,6 +50,7 @@ diff --git a/tests/visual/selectmenu/events.html b/tests/visual/selectmenu/events.html index 02c58db3c..7c7d0ac57 100644 --- a/tests/visual/selectmenu/events.html +++ b/tests/visual/selectmenu/events.html @@ -38,6 +38,7 @@ diff --git a/tests/visual/selectmenu/option.html b/tests/visual/selectmenu/option.html index 1f70d0e56..fe04c89fa 100644 --- a/tests/visual/selectmenu/option.html +++ b/tests/visual/selectmenu/option.html @@ -30,6 +30,7 @@ diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 50f1264e5..6bdfd95ae 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -109,7 +109,7 @@ $.widget( "ui.selectmenu", { }); // wrap and insert new button - that.newelementWrap = $( '
' ) + that.newelementWrap = $( '' ) .append( that.newelement ) .insertAfter( that.element ); }, From d1208900f853784c4ba38c07bc188792d3767ead Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Wed, 5 Oct 2011 00:50:59 +0200 Subject: [PATCH 033/386] Selectmenu: fixed CSS class for button wrapper --- ui/jquery.ui.selectmenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 6bdfd95ae..3ff1e62ff 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -100,7 +100,6 @@ $.widget( "ui.selectmenu", { 'aria-owns': that.ids[ 2 ], 'aria-haspopup': true }) - .addClass( that.widgetBaseClass + '-button' ) .button({ label: this.element.find( "option:selected" ).text(), icons: { @@ -110,6 +109,7 @@ $.widget( "ui.selectmenu", { // wrap and insert new button that.newelementWrap = $( '' ) + .addClass( that.widgetBaseClass + '-button' ) .append( that.newelement ) .insertAfter( that.element ); }, From 6351880e0926c2468b499559bbca02becb464ec6 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Thu, 6 Oct 2011 00:24:58 +0200 Subject: [PATCH 034/386] Selectmenu: removed outdated comment --- ui/jquery.ui.selectmenu.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 3ff1e62ff..daadc07fb 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -178,7 +178,6 @@ $.widget( "ui.selectmenu", { }); }, - // TODO update the value option refresh: function() { var that = this, options = this.options; From 0dc020f79beb84dc92257ea497623337248ad55a Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Thu, 6 Oct 2011 00:35:42 +0200 Subject: [PATCH 035/386] Selectmenu: fixed positioning (change to inline element follow-up) --- ui/jquery.ui.selectmenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index daadc07fb..d4cd9180d 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -244,7 +244,7 @@ $.widget( "ui.selectmenu", { that.listWrap .zIndex( that.element.zIndex() + 1 ) .position( $.extend({ - of: that.newelementWrap + of: that.newelement }, options.position )); that.opened = true; From 3ba99cbd6b7250b88b8a4faf986f1ae81c56774d Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Thu, 6 Oct 2011 00:38:22 +0200 Subject: [PATCH 036/386] Selectmenu: code cleanup --- themes/base/jquery.ui.selectmenu.css | 3 +-- ui/jquery.ui.selectmenu.js | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/themes/base/jquery.ui.selectmenu.css b/themes/base/jquery.ui.selectmenu.css index 019273672..46b78ea44 100644 --- a/themes/base/jquery.ui.selectmenu.css +++ b/themes/base/jquery.ui.selectmenu.css @@ -7,7 +7,7 @@ * * http://docs.jquery.com/UI/Selectmenu#theming */ - + .ui-selectmenu-menu { padding: 0; margin: 0; position:absolute; top: 0; display: none; } .ui-selectmenu-menu .ui-menu .ui-menu-item { width: auto; } .ui-selectmenu-menu .ui-menu .ui-menu-item a { padding: 0.3em 1em 0.3em 1em; } @@ -15,6 +15,5 @@ .ui-selectmenu-menu .ui-menu li.ui-selectmenu-optgroup { font-weight: bold; line-height: 1.5; padding: 2px 0.4em; margin: 0.5em 0 0 0; } .ui-selectmenu-open { display: block; } -.ui-selectmenu-button { margin-right: 0; } .ui-selectmenu-button span.ui-icon { right: 0.5em; left: auto; } .ui-selectmenu-button span.ui-button-text { text-align: left; padding: 0.4em 2.1em 0.4em 1em } \ No newline at end of file diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index d4cd9180d..f00acf41a 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -187,7 +187,6 @@ $.widget( "ui.selectmenu", { that._initSource(); that._renderMenu( that.list, that.items ); - // this.menu.blur(); that.list.menu( "refresh" ); // adjust ARIA From 37d22ee017f3d90080bb5acb867889fb4e50edbc Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Thu, 6 Oct 2011 01:09:12 +0200 Subject: [PATCH 037/386] Selectmenu: fixed unwanted focus events --- ui/jquery.ui.selectmenu.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index f00acf41a..f161c9bc7 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -172,8 +172,10 @@ $.widget( "ui.selectmenu", { that.close( event, true); }, - focus: function( event, ui ) { - that._trigger( "focus", event, { item: ui.item.data( "item.selectmenu" ) } ); + focus: function( event, ui ) { + var item = ui.item.data( "item.selectmenu" ); + if ( that.focus !== undefined && item.index != that.focus ) that._trigger( "focus", event, { item: item } ); + that.focus = item.index; } }); }, @@ -302,15 +304,9 @@ $.widget( "ui.selectmenu", { }, _move: function( key, event ) { - // TODO this focus is needed to make the select below work, - // but should be removed as its fires an unwanted focus event - if ( !this.opened ) { - this.list.menu( "focus", event, this._getSelectedItem() ); - } + if ( !this.opened ) this.list.menu( "focus", event, this._getSelectedItem() ); this.list.menu( key, event ); - if ( !this.opened ) { - this.list.menu( "select", event ); - } + if ( !this.opened ) this.list.menu( "select", event ); }, _getSelectedItem: function() { From d7e23ce225b6fe08cfa779df0f7e70e4d95a0883 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Sun, 9 Oct 2011 00:09:16 +0200 Subject: [PATCH 038/386] Selectmenu: fixed event for hovering, click scrollbar issue --- ui/jquery.ui.selectmenu.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index f161c9bc7..c02b8988a 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -139,11 +139,10 @@ $.widget( "ui.selectmenu", { 'click': function( event ) { event.preventDefault(); }, - // namespacing is needed (_bind should do the trick, but it doesnt) - 'mouseenter.selectmenu': function() { + mouseenter: function() { that.hover = true; }, - 'mouseleave.selectmenu': function() { + mouseleave: function() { that.hover = false; } }); From f4454ce30e00cdbd501c323abccc11dcc3d44e9f Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Sun, 9 Oct 2011 00:47:09 +0200 Subject: [PATCH 039/386] Selectmenu: fixed click scrollbar issue (follow up), improved document event handling --- ui/jquery.ui.selectmenu.js | 70 +++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index c02b8988a..c0d6fbe40 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -52,31 +52,6 @@ $.widget( "ui.selectmenu", { options.value = that.element[0].value; } - that._addNewelement(); - that._addList(); - - // built menu - that.refresh(); - - that._bind( that.newelement, that._newelementEvents ); - - // document click closes menu - that._bind( document, { - 'mousedown': function( event ) { - if ( that.opened && !that.hover) { - window.setTimeout( function() { - that.close( event ); - }, 200 ); - } - } - }); - }, - - _addNewelement: function() { - var that = this, - options = this.options, - tabindex = this.element.attr( 'tabindex' ); - // catch click event of the label that._bind({ 'click': function( event ) { @@ -85,6 +60,19 @@ $.widget( "ui.selectmenu", { } }); + that._addNewelement(); + that._bind( that.newelement, that._newelementEvents ); + + that._addList(); + that.refresh(); + + }, + + _addNewelement: function() { + var that = this, + options = this.options, + tabindex = this.element.attr( 'tabindex' ); + // hide original select tag that.element.hide(); @@ -134,18 +122,6 @@ $.widget( "ui.selectmenu", { var text = that.newelement.find( "span.ui-button-text"); var setWidth = text.width() + parseFloat( text.css( "padding-left" ) ) + parseFloat( text.css( "margin-left" ) ); } - - that._bind( that.list, { - 'click': function( event ) { - event.preventDefault(); - }, - mouseenter: function() { - that.hover = true; - }, - mouseleave: function() { - that.hover = false; - } - }); // wrap list that.listWrap = $( '
' ) @@ -177,6 +153,23 @@ $.widget( "ui.selectmenu", { that.focus = item.index; } }); + + that._bind( that.list, { + 'click': function( event ) { + event.preventDefault(); + } + }); + + // document click closes menu + that._bind( document, { + 'mousedown': function( event ) { + if ( that.opened && !$( event.target ).is( that.list ) ) { + window.setTimeout( function() { + that.close( event ); + }, 200 ); + } + } + }); }, refresh: function() { @@ -255,7 +248,6 @@ $.widget( "ui.selectmenu", { close: function( event, focus ) { var that = this, options = this.options; - if ( that.opened ) { if ( options.dropdown ) { that.newelement @@ -332,7 +324,7 @@ $.widget( "ui.selectmenu", { keydown: function( event ) { switch (event.keyCode) { case $.ui.keyCode.TAB: - if ( this.opened ) this.close(); + if ( this.opened ) this.close( event ); break; case $.ui.keyCode.ENTER: if ( this.opened ) { From ba748232c13e65b1f1ae1a781a8e3a7378d6532d Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Sun, 9 Oct 2011 01:54:36 +0200 Subject: [PATCH 040/386] Selectmenu: added custom_render.html demo, removed widgetBaseClass --- demos/selectmenu/custom_render.html | 120 ++++++++++++++++++ demos/selectmenu/images/24-podcast-square.png | Bin 0 -> 681 bytes demos/selectmenu/images/24-rss-square.png | Bin 0 -> 594 bytes demos/selectmenu/images/24-video-square.png | Bin 0 -> 649 bytes ui/jquery.ui.selectmenu.js | 10 +- 5 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 demos/selectmenu/custom_render.html create mode 100644 demos/selectmenu/images/24-podcast-square.png create mode 100644 demos/selectmenu/images/24-rss-square.png create mode 100644 demos/selectmenu/images/24-video-square.png diff --git a/demos/selectmenu/custom_render.html b/demos/selectmenu/custom_render.html new file mode 100644 index 000000000..c2620c3db --- /dev/null +++ b/demos/selectmenu/custom_render.html @@ -0,0 +1,120 @@ + + + + + jQuery UI Selectmenu - Default functionality + + + + + + + + + + + + + + +
+ +
+ +

"popup" style with framework icons

+
+ + +
+ +

"popup" style with custom icon images

+
+ + +
+ +

"dropdown" style with custom avatar 16x16 images as CSS background

+
+ + +
+ +
+ +
+ + + +
+

The whole rendering process is extendable to make custom styling as easy as possible.

+
+ + + diff --git a/demos/selectmenu/images/24-podcast-square.png b/demos/selectmenu/images/24-podcast-square.png new file mode 100644 index 0000000000000000000000000000000000000000..3c3e38f3fcddf7ea952f33d6e77aa32a0da1286a GIT binary patch literal 681 zcmV;a0#^NrP)gIGB@X*^L^)!d!smxLvJZ6y|Ki^W^-eOJ{^2{m2|Gg_mr90uQCC^d&j$I zV7i;AT^fbx-&URofzIMrfB@1znIfyg(Cs!ERE1+)ACw-K2x69Pvg<4Xt33imQ%Frj z^Z;U&9kQwpIpzaFEa}dH-Yw6Ak+g-v+5V z1Gm*^0)RJIL|wzW4^TNby>CNu{P;QUeFa3EN=HWYm~sNvU;!?G^Vxc621b(}MDQ)2 zHd>cRM2(0m7p4r-@0tho*Sl3;kA4Y^Py(clrU5*+U7&i=qSTO1V{<*B<@vLIONBFo z5=o6lr&3(c&vH*(6`8gF^r1(i$?ts}T-1N(_a$GVCpd!*Y~k~)y9iMQqec%5mKA_U zCX#$%51r@_Y~cgnmINYF0S*V#8(jb|@BiQnd!ZMg!l!xKB!ZJ{NdiZGA*aV>I?NP( zJM5u@z$QonjL0VIovH+mNFiu8WM2L0+X@|QKnNcYaEwYs2DnR_B^ddty~J18Srmqp zK_aF3jYDK814hu7yk{5C!3MS$H#P1H4C^j}AZD0U&|QF=nnB5QT#DvfdMR`iVGEyv zV{!~DECcom{bG;K0;{gf`T{}ZmWM?&_$Y%#cJNwH@uJ_8cmJ>AUVs4r{WUbjafV`k P00000NkvXXu0mjf+{`9D literal 0 HcmV?d00001 diff --git a/demos/selectmenu/images/24-rss-square.png b/demos/selectmenu/images/24-rss-square.png new file mode 100644 index 0000000000000000000000000000000000000000..f59b69ed38616a3f68b17bc423e0633e85bb3705 GIT binary patch literal 594 zcmV-Y0Fy+ghzf2+C|y)gaZu2xv_c0F+q6xS`0mn# z#wJSJbnwCJU0!iP$~duO#*y`X-Mgl`V=ukaa}1RKy4Dh0pb15dq7Pu zBA{Hvd{uxO8m$+|K7lG1en~#cslh)0=ulCd1;T^CRY8^9yTg&;arN3SfRYTl`~`q% zQqt#j<9T72L8#M#iuCZ~3z!~4{sQEUG&xx5{t^H^Ffzd)ycsjkkUwao$rXUY8ik;T z#3ftq<*N(pk@iEPu@bE&POvKY`~i2s$IA^UxmQs0pCHr%P>2a4NZQ|KAz^&Vh+}KU zxUO#Cd;8r1wI=PxtiG_gZsp#zx1&AiTivn6nyy7`hB$i*Mt}LZ%9e^Mk2!|4i6err`$Qx_W>sR5wr8 z8m!blV?4Sm;90tZ0bvx>&TiCK8`S5RIMr|j;4QS3NhUTjkJnz@Xj@Jz*u)oJUB#O< g<>R0KtN0dR02OM%l*8g-^Z)<=07*qoM6N<$f_qI5g#Z8m literal 0 HcmV?d00001 diff --git a/demos/selectmenu/images/24-video-square.png b/demos/selectmenu/images/24-video-square.png new file mode 100644 index 0000000000000000000000000000000000000000..ce50ccfde3807851e72b35638f32862fa354bb2a GIT binary patch literal 649 zcmV;40(Sk0P)8COt?fa5Dbh2ACV~H3lZPz*U-&Ot9yI<2=0TA z9&5U)`|GNyR=Hd*^qnx#H{%C?&|ZGii}vSBtnv)SC(p;l28Iv$T?wOSu18N1r=_l$?b z!N621#ez2)4MF^d9q+jxS9VtccEBgg$Ye5Xj7FovR;$%0pU;c=@I{P=3itx|7>~!< zob7fi2*hGB!#sI`cPpq=D&iRRs8*~0rhuO%==1pmkvtG*Un-SEvO}Se!RJi{yxKcs4A|yJj+(yf_>VTCG;>JCM7g z9*f1|#)h3ExZQ4NUAb5+8t;SaE%b~RXuas^T!EZq*zqCBgb#cX1F>!t;L5xr`$boA jmS365fB&!IRe%8iji0Y)z8;%000000NkvXXu0mjf4^S>X literal 0 HcmV?d00001 diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index c0d6fbe40..4b385f6dd 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -97,7 +97,7 @@ $.widget( "ui.selectmenu", { // wrap and insert new button that.newelementWrap = $( '' ) - .addClass( that.widgetBaseClass + '-button' ) + .addClass( 'ui-selectmenu-button' ) .append( that.newelement ) .insertAfter( that.element ); }, @@ -125,7 +125,7 @@ $.widget( "ui.selectmenu", { // wrap list that.listWrap = $( '
' ) - .addClass( that.widgetBaseClass + '-menu' ) + .addClass( 'ui-selectmenu-menu' ) .width( setWidth ) .append( that.list ) .appendTo( options.appendTo ); @@ -207,7 +207,7 @@ $.widget( "ui.selectmenu", { if ( !options.disabled ) { // close all other selectmenus - $( '.' + that.widgetBaseClass + '-open' ).not( that.newelement ).each( function() { + $( '.ui-selectmenu-open' ).not( that.newelement ).each( function() { $( this ).children( 'ul.ui-menu' ).data( 'element.selectelemenu' ).selectmenu( 'close' ); }); @@ -217,7 +217,7 @@ $.widget( "ui.selectmenu", { .removeClass( 'ui-corner-all' ); } - that.listWrap.addClass( that.widgetBaseClass + '-open' ); + that.listWrap.addClass( 'ui-selectmenu-open' ); that.list.menu( "focus", null, currentItem ); if ( !options.dropdown ) { @@ -255,7 +255,7 @@ $.widget( "ui.selectmenu", { .removeClass( 'ui-corner-top' ); } - that.listWrap.removeClass( that.widgetBaseClass + '-open' ); + that.listWrap.removeClass( 'ui-selectmenu-open' ); this.opened = false; if (focus) that.newelement.focus(); From f70a24790c8bb626048052315ae5c6e0b485d064 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Sun, 9 Oct 2011 02:00:52 +0200 Subject: [PATCH 041/386] Selectmenu: fixed disabled.html demo --- tests/visual/selectmenu/disabled.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/visual/selectmenu/disabled.html b/tests/visual/selectmenu/disabled.html index b7861f6c8..0e98e014e 100644 --- a/tests/visual/selectmenu/disabled.html +++ b/tests/visual/selectmenu/disabled.html @@ -39,10 +39,10 @@ }); $("#disable_optgroup").toggle( function() { files2.find("optgroup:eq(0)").attr("disabled", "disabled"); - //files2.selectmenu("refresh"); + files2.selectmenu("refresh"); }, function() { - files2.find("option:eq(0)").removeAttr("disabled"); - //files2.selectmenu("refresh"); + files2.find("optgroup:eq(0)").removeAttr("disabled"); + files2.selectmenu("refresh"); }); }); From 8944abce67c69553baae15fd66b5216eeb8f44f7 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Mon, 10 Oct 2011 20:08:47 +0200 Subject: [PATCH 042/386] Selectmenu: fixed destroy method, show original select again, thx to @jzaefferer --- ui/jquery.ui.selectmenu.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 4b385f6dd..113c53e31 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -60,12 +60,11 @@ $.widget( "ui.selectmenu", { } }); - that._addNewelement(); + that._addNewelement(); that._bind( that.newelement, that._newelementEvents ); that._addList(); - that.refresh(); - + that.refresh(); }, _addNewelement: function() { @@ -414,6 +413,7 @@ $.widget( "ui.selectmenu", { _destroy: function() { this.listWrap.remove(); this.newelementWrap.remove(); + this.element.show(); } }); From 2be6e70bba4cd3cf9a913372c97f44b91b2634e6 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Mon, 10 Oct 2011 20:09:03 +0200 Subject: [PATCH 043/386] Selectmenu: added test for methods --- tests/visual/selectmenu/methods.html | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 tests/visual/selectmenu/methods.html diff --git a/tests/visual/selectmenu/methods.html b/tests/visual/selectmenu/methods.html new file mode 100644 index 000000000..e004f40a1 --- /dev/null +++ b/tests/visual/selectmenu/methods.html @@ -0,0 +1,62 @@ + + + + + jQuery UI Selectmenu - Event functionality + + + + + + + + + + + + + + +
+ +
+
+ + +
+
+
+ + + +
+ + + + + From ee26baa997710ea870ab27f6d00b4efd01809859 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Mon, 10 Oct 2011 20:27:29 +0200 Subject: [PATCH 044/386] Selectmenu: improved event handling, fixed anchor problem when clicking menu item --- ui/jquery.ui.selectmenu.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 113c53e31..15019945f 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -144,7 +144,10 @@ $.widget( "ui.selectmenu", { if ( flag ) that._trigger( "change", event, { item: item } ); - that.close( event, true); + if ( that.opened ) { + event.preventDefault(); + that.close( event, true); + } }, focus: function( event, ui ) { var item = ui.item.data( "item.selectmenu" ); @@ -152,12 +155,6 @@ $.widget( "ui.selectmenu", { that.focus = item.index; } }); - - that._bind( that.list, { - 'click': function( event ) { - event.preventDefault(); - } - }); // document click closes menu that._bind( document, { From ace8f3ed535d2c7ab5c90675cfe844e7f0ee0e57 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Mon, 10 Oct 2011 21:11:15 +0200 Subject: [PATCH 045/386] Selectmenu: added custom_render.html demo to index.html --- demos/selectmenu/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/demos/selectmenu/index.html b/demos/selectmenu/index.html index 909c3e262..45aa0c8e1 100644 --- a/demos/selectmenu/index.html +++ b/demos/selectmenu/index.html @@ -10,6 +10,7 @@

Examples

From 469426160e7f87e9dacaa53cfab439ac9d86adc2 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Wed, 12 Oct 2011 01:24:04 +0200 Subject: [PATCH 046/386] Selectmenu: removed unneeded that, use this instead --- ui/jquery.ui.selectmenu.js | 162 +++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 87 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 15019945f..2b6276e65 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -37,101 +37,96 @@ $.widget( "ui.selectmenu", { }, _create: function() { - var that = this, - options = this.options, - // set a default id value, generate a new random one if not set by developer - selectmenuId = that.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 ); + // set a default id value, generate a new random one if not set by developer + var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 ); // quick array of button and menu id's - that.ids = [ selectmenuId, selectmenuId + '-button', selectmenuId + '-menu' ]; + this.ids = [ selectmenuId, selectmenuId + '-button', selectmenuId + '-menu' ]; // set current value - if ( options.value ) { - that.element[0].value = options.value; + if ( this.options.value ) { + this.element[0].value = this.options.value; } else { - options.value = that.element[0].value; + this.options.value = this.element[0].value; } // catch click event of the label - that._bind({ + this._bind({ 'click': function( event ) { - that.newelement.focus(); + this.newelement.focus(); event.preventDefault(); } }); - that._addNewelement(); - that._bind( that.newelement, that._newelementEvents ); + this._addNewelement(); + this._bind( this.newelement, this._newelementEvents ); - that._addList(); - that.refresh(); + this._addList(); + this.refresh(); }, _addNewelement: function() { - var that = this, - options = this.options, - tabindex = this.element.attr( 'tabindex' ); + var tabindex = this.element.attr( 'tabindex' ); // hide original select tag - that.element.hide(); + this.element.hide(); // create button - that.newelement = $( '', { - href: '#' + that.ids[ 0 ], - tabindex: ( tabindex ? tabindex : that.element.attr( 'disabled' ) ? 1 : 0 ), - id: that.ids[ 1 ], + this.newelement = $( '', { + href: '#' + this.ids[ 0 ], + tabindex: ( tabindex ? tabindex : this.element.attr( 'disabled' ) ? 1 : 0 ), + id: this.ids[ 1 ], css: { - width: that.element.outerWidth() + width: this.element.outerWidth() }, - 'aria-disabled': options.disabled, - 'aria-owns': that.ids[ 2 ], + 'aria-disabled': this.options.disabled, + 'aria-owns': this.ids[ 2 ], 'aria-haspopup': true }) .button({ label: this.element.find( "option:selected" ).text(), icons: { - primary: ( options.dropdown ? 'ui-icon-triangle-1-s' : 'ui-icon-triangle-2-n-s' ) + primary: ( this.options.dropdown ? 'ui-icon-triangle-1-s' : 'ui-icon-triangle-2-n-s' ) } }); // wrap and insert new button - that.newelementWrap = $( '' ) + this.newelementWrap = $( '' ) .addClass( 'ui-selectmenu-button' ) - .append( that.newelement ) - .insertAfter( that.element ); + .append( this.newelement ) + .insertAfter( this.element ); }, _addList: function() { - var that = this, - options = this.options; + var that = this; // create menu portion, append to body - that.list = $( '