File tree Expand file tree Collapse file tree 3 files changed +25
-17
lines changed Expand file tree Collapse file tree 3 files changed +25
-17
lines changed Original file line number Diff line number Diff line change @@ -5169,7 +5169,7 @@ ol.control.Search = class olcontrolSearch extends ol.control.Control {
5169
5169
self.dispatchEvent({ type: "change:input", input: e, value: input.value });
5170
5170
});
5171
5171
var doSearch = function (e) {
5172
- // console.log(e.type+" "+e.key)'
5172
+ // console.log(e.type+" "+e.key)
5173
5173
var li = element.querySelector("ul.autocomplete li.select");
5174
5174
var val = input.value;
5175
5175
// move up/down
@@ -5183,8 +5183,10 @@ ol.control.Search = class olcontrolSearch extends ol.control.Control {
5183
5183
}
5184
5184
} else {
5185
5185
li = element.querySelector("ul.autocomplete li")
5186
- li.classList.add("select");
5187
- input.value = li.innerText;
5186
+ if (li) {
5187
+ li.classList.add("select");
5188
+ input.value = li.innerText;
5189
+ }
5188
5190
}
5189
5191
}
5190
5192
// Clear input
@@ -5215,20 +5217,22 @@ ol.control.Search = class olcontrolSearch extends ol.control.Control {
5215
5217
cur = val;
5216
5218
if (cur) {
5217
5219
// prevent searching on each typing
5218
- if (tout)
5220
+ if (tout) {
5219
5221
clearTimeout(tout);
5222
+ }
5220
5223
var minLength = self.get("minLength");
5221
5224
tout = setTimeout(function () {
5222
5225
if (cur.length >= minLength) {
5223
5226
var s = self.autocomplete(cur, function (auto) { self.drawList_(auto); });
5224
- if (s)
5227
+ if (s) {
5225
5228
self.drawList_(s);
5226
- }
5227
- else
5229
+ }
5230
+ } else {
5228
5231
self.drawList_();
5232
+ }
5229
5233
}, options.typing);
5230
5234
} else {
5231
- self.drawList_();
5235
+ self.drawList_();
5232
5236
}
5233
5237
}
5234
5238
// Clear list selection
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ var ol_control_Search = class olcontrolSearch extends ol_control_Control {
99
99
self . dispatchEvent ( { type : "change:input" , input : e , value : input . value } ) ;
100
100
} ) ;
101
101
var doSearch = function ( e ) {
102
- // console.log(e.type+" "+e.key)'
102
+ // console.log(e.type+" "+e.key)
103
103
var li = element . querySelector ( "ul.autocomplete li.select" ) ;
104
104
var val = input . value ;
105
105
// move up/down
@@ -113,8 +113,10 @@ var ol_control_Search = class olcontrolSearch extends ol_control_Control {
113
113
}
114
114
} else {
115
115
li = element . querySelector ( "ul.autocomplete li" )
116
- li . classList . add ( "select" ) ;
117
- input . value = li . innerText ;
116
+ if ( li ) {
117
+ li . classList . add ( "select" ) ;
118
+ input . value = li . innerText ;
119
+ }
118
120
}
119
121
}
120
122
@@ -148,20 +150,22 @@ var ol_control_Search = class olcontrolSearch extends ol_control_Control {
148
150
cur = val ;
149
151
if ( cur ) {
150
152
// prevent searching on each typing
151
- if ( tout )
153
+ if ( tout ) {
152
154
clearTimeout ( tout ) ;
155
+ }
153
156
var minLength = self . get ( "minLength" ) ;
154
157
tout = setTimeout ( function ( ) {
155
158
if ( cur . length >= minLength ) {
156
159
var s = self . autocomplete ( cur , function ( auto ) { self . drawList_ ( auto ) ; } ) ;
157
- if ( s )
160
+ if ( s ) {
158
161
self . drawList_ ( s ) ;
159
- }
160
- else
162
+ }
163
+ } else {
161
164
self . drawList_ ( ) ;
165
+ }
162
166
} , options . typing ) ;
163
167
} else {
164
- self . drawList_ ( ) ;
168
+ self . drawList_ ( ) ;
165
169
}
166
170
}
167
171
You can’t perform that action at this time.
0 commit comments