Skip to content

Commit 6e8992d

Browse files
remove select support
1 parent d0dc0b7 commit 6e8992d

File tree

2 files changed

+6
-37
lines changed

2 files changed

+6
-37
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@
88
"brunch-typescript": "1.6.*",
99
"uglify-js-brunch": "1.7.*",
1010
"less-brunch": "1.8.*"
11+
},
12+
"scripts": {
13+
"dev": "brunch build",
14+
"prod": "brunch build -P",
15+
"watch": "brunch watch"
1116
}
1217
}

src/autocomplete.ts

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ interface Params {
2525
DOMResults: HTMLElement;
2626
Request: XMLHttpRequest;
2727
Input: Element;
28-
Select: Element;
2928

3029
// Workflow methods
3130
_Blur: any;
@@ -189,7 +188,6 @@ class AutoComplete {
189188
DOMResults: null,
190189
Request: null,
191190
Input: null,
192-
Select: null,
193191

194192
/**
195193
* Return the message when no result returns
@@ -429,19 +427,6 @@ class AutoComplete {
429427
this.Input.value = item.innerHTML;
430428
}
431429
this.Input.setAttribute("data-autocomplete-old-value", this.Input.value);
432-
433-
if (this.Select !== void 0) {
434-
var option: HTMLElement = document.createElement("option");
435-
option.setAttribute("value", this.Input.value);
436-
option.setAttribute("selected", "selected");
437-
option.innerHTML = item.innerHTML;
438-
439-
if (this.Select.hasChildNodes()) {
440-
this.Select.childNodes[0].remove();
441-
}
442-
443-
this.Select.appendChild(option);
444-
}
445430
},
446431

447432
$AjaxTimer: null,
@@ -479,28 +464,7 @@ class AutoComplete {
479464
console.log("Object", params);
480465
console.log(element)
481466

482-
if (element.nodeName.match(/^SELECT$/i)) {
483-
params.Select = element;
484-
485-
params.Select.setAttribute("style", "display:none;");
486-
487-
var input = document.createElement("input");
488-
input.setAttribute("type", "search");
489-
input.setAttribute("autocomplete", "off");
490-
491-
params.Select.parentNode.appendChild(input);
492-
493-
var attributes: NamedNodeMap = params.Select.attributes;
494-
for (var i = attributes.length - 1; i >= 0; i--) {
495-
if (attributes[i].name.match(/^data-autocomplete/i)) {
496-
input.setAttribute(attributes[i].name, attributes[i].value);
497-
}
498-
}
499-
500-
params.Input = input;
501-
} else {
502-
params.Input = element;
503-
}
467+
params.Input = element;
504468

505469
if (params.Input.nodeName.match(/^INPUT$/i) && params.Input.getAttribute("type").match(/^TEXT|SEARCH$/i)) {
506470
params.Input.setAttribute("autocomplete", "off");

0 commit comments

Comments
 (0)