aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2016-11-16 12:52:15 -0500
committerScott González <scott.gonzalez@gmail.com>2016-11-16 12:52:15 -0500
commita2b25ef6caae3e1a272214839b815a6387618124 (patch)
treefe0b441544fcce9e597109bde89348e1f6256eb4
parent9a4c0571577e20795c19796594747f0f8beb476a (diff)
downloadjquery-ui-a2b25ef6caae3e1a272214839b815a6387618124.tar.gz
jquery-ui-a2b25ef6caae3e1a272214839b815a6387618124.zip
Selectmenu: Don't render options with the `hidden` attribute
Fixes #15098
-rw-r--r--tests/unit/selectmenu/core.js26
-rw-r--r--ui/widgets/selectmenu.js4
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/selectmenu/core.js b/tests/unit/selectmenu/core.js
index a5bc68e0f..cef6dc5bf 100644
--- a/tests/unit/selectmenu/core.js
+++ b/tests/unit/selectmenu/core.js
@@ -376,4 +376,30 @@ QUnit.test( "Number pad input should change value", function( assert ) {
} );
} );
+QUnit.test( "Options with hidden attribute should not be rendered", function( assert ) {
+ var ready = assert.async();
+ assert.expect( 1 );
+
+ var button, menu, options,
+ element = $( "#speed" );
+
+ element.find( "option" ).eq( 1 ).prop( "hidden", true );
+ element.selectmenu();
+ button = element.selectmenu( "widget" );
+ menu = element.selectmenu( "menuWidget" );
+
+ button.simulate( "focus" );
+ setTimeout( function() {
+ button.trigger( "click" );
+ options = menu.children()
+ .map( function() {
+ return $( this ).text();
+ } )
+ .get();
+ assert.deepEqual( options, [ "Slower", "Medium", "Fast", "Faster" ], "correct elements" );
+
+ ready();
+ } );
+} );
+
} );
diff --git a/ui/widgets/selectmenu.js b/ui/widgets/selectmenu.js
index 900a245f7..52139f73e 100644
--- a/ui/widgets/selectmenu.js
+++ b/ui/widgets/selectmenu.js
@@ -656,6 +656,10 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
var that = this,
data = [];
options.each( function( index, item ) {
+ if ( item.hidden ) {
+ return;
+ }
+
data.push( that._parseOption( $( item ), index ) );
} );
this.items = data;
crl Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/cron.php
blob: e77cc885aba79d48949f12fc2e6b4922f29f78b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143