Skip to content

Commit 5ec0dd8

Browse files
committed
Autocomplete combobox demo: Fixed styling of button. Fixed #8242 - Autocomplete combobox button has vertical offset relatively to input field (Opera 11.62). Fixed #8243 - Autocomplete combobox button has smaller height than input field (Firefox 11.0).
(cherry picked from commit 218bd47) Conflicts: demos/autocomplete/combobox.html
1 parent 9668cb8 commit 5ec0dd8

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

demos/autocomplete/combobox.html

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,42 @@
1212
<script src="../../ui/jquery.ui.autocomplete.js"></script>
1313
<link rel="stylesheet" href="../demos.css">
1414
<style>
15-
.ui-button { margin-left: -1px; }
16-
.ui-button-icon-only .ui-button-text { padding: 0.35em; }
17-
.ui-autocomplete-input { margin: 0; padding: 0.48em 0 0.47em 0.45em; }
15+
.ui-combobox {
16+
position: relative;
17+
display: inline-block;
18+
}
19+
.ui-button {
20+
position: absolute;
21+
top: 0;
22+
bottom: 0;
23+
margin-left: -1px;
24+
padding: 0;
25+
/* adjust styles for IE 6/7 */
26+
*height: 1.7em;
27+
*top: 0.1em;
28+
}
29+
.ui-autocomplete-input {
30+
margin: 0;
31+
padding: 0.3em;
32+
}
1833
</style>
1934
<script>
2035
(function( $ ) {
2136
$.widget( "ui.combobox", {
2237
_create: function() {
23-
var self = this,
38+
var input,
39+
self = this,
2440
select = this.element.hide(),
2541
selected = select.children( ":selected" ),
26-
value = selected.val() ? selected.text() : "";
27-
var input = this.input = $( "<input>" )
28-
.insertAfter( select )
42+
value = selected.val() ? selected.text() : "",
43+
wrapper = $( "<span>" )
44+
.addClass( "ui-combobox" )
45+
.insertAfter( select );
46+
47+
input = $( "<input>" )
48+
.appendTo( wrapper )
2949
.val( value )
50+
.addClass( "ui-state-default" )
3051
.autocomplete({
3152
delay: 0,
3253
minLength: 0,
@@ -82,10 +103,10 @@
82103
.appendTo( ul );
83104
};
84105

85-
this.button = $( "<button type='button'>&nbsp;</button>" )
106+
$( "<a>" )
86107
.attr( "tabIndex", -1 )
87108
.attr( "title", "Show All Items" )
88-
.insertAfter( input )
109+
.appendTo( wrapper )
89110
.button({
90111
icons: {
91112
primary: "ui-icon-triangle-1-s"
@@ -111,8 +132,7 @@
111132
},
112133

113134
destroy: function() {
114-
this.input.remove();
115-
this.button.remove();
135+
this.wrapper.remove();
116136
this.element.show();
117137
$.Widget.prototype.destroy.call( this );
118138
}
@@ -128,7 +148,7 @@
128148
</script>
129149
</head>
130150
<body>
131-
151+
132152
<div class="demo">
133153

134154
<div class="ui-widget">

0 commit comments

Comments
 (0)