diff --git a/app/javascript/src/classes/tag_completion_box.coffee b/app/javascript/src/classes/tag_completion_box.coffee index 24dbef43c..7114e49f2 100644 --- a/app/javascript/src/classes/tag_completion_box.coffee +++ b/app/javascript/src/classes/tag_completion_box.coffee @@ -1,3 +1,15 @@ +createCompletionBox = -> + ret = document.createElement('div') + ret.className = 'tag-completion-box' + ret.tabIndex = -1 + + types = document.createElement('ul') + types.className = 'color-tag-types' + ret.appendChild types + + ret + + export default class TagCompletionBox constructor: (input_field) -> @input_field = input_field @@ -5,11 +17,8 @@ export default class TagCompletionBox # Disable browser autocomplete. @input_field.setAttribute 'autocomplete', 'off' - html = '
' - div = html.createElement() - div.tabindex = -1 - document.body.appendChild div - @completion_box = div + @completion_box = createCompletionBox() + document.body.appendChild @completion_box document.on 'mousedown', (event) => if event.target.isParentNode(@input_field) or event.target.isParentNode(@completion_box) return