File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ <h2>Select multiple inputs</h2>
67
67
multiple
68
68
>
69
69
< option value ="Choice 1 "> <!-- html comment --> Choice 1</ option >
70
- < option value ="Choice 2 "> Choice 2</ option >
70
+ < option value ="Choice 2 " label =" Choice 2 " / >
71
71
< option value ="Find me "> Choice 3</ option >
72
72
< option value ="Choice 4 "> Choice 4</ option >
73
73
</ select >
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ <h2>Select one inputs</h2>
62
62
< button class ="enable push-bottom "> Enable</ button >
63
63
< select class ="form-control " name ="choices-basic " id ="choices-basic ">
64
64
< option value ="Choice 1 "> <!-- html comment --> Choice 1</ option >
65
- < option value ="Choice 2 "> Choice 2</ option >
65
+ < option value ="Choice 2 " label =" Choice 2 " / >
66
66
< option value ="Find me "> Choice 3</ option >
67
67
< option value ="Choice 4 "> Choice 4</ option >
68
68
</ select >
Original file line number Diff line number Diff line change @@ -81,7 +81,12 @@ export default class WrappedSelect extends WrappedElement<HTMLSelectElement> {
81
81
score : 0 ,
82
82
rank : 0 ,
83
83
value : option . value ,
84
- label : option . innerText , // HTML options do not support most html tags, but innerHtml will extract html comments...
84
+ label :
85
+ // HTML options do not support most html tags, but innerHtml will extract html comments...
86
+ // <option label="..." /> innerText is full of whitespace
87
+ ! option . innerText . trim ( ) && option . hasAttribute ( 'label' )
88
+ ? option . getAttribute ( 'label' ) || ''
89
+ : option . innerText ,
85
90
element : option ,
86
91
active : true ,
87
92
// this returns true if nothing is selected on initial load, which will break placeholder support
You can’t perform that action at this time.
0 commit comments