diff --git a/umap/static/umap/js/modules/autocomplete.js b/umap/static/umap/js/modules/autocomplete.js index 003c82fb..ffc7cdbd 100644 --- a/umap/static/umap/js/modules/autocomplete.js +++ b/umap/static/umap/js/modules/autocomplete.js @@ -7,6 +7,7 @@ import { import { translate } from './i18n.js' import { Request, ServerRequest } from './request.js' import { escapeHTML, generateId } from './utils.js' +import * as Utils from './utils.js' export class BaseAutocomplete { constructor(parent, options) { @@ -291,10 +292,9 @@ class BaseServerAjax extends BaseAjax { export const SingleMixin = (Base) => class extends Base { initSelectedContainer() { - return DomUtil.after( - this.input, - DomUtil.element({ tagName: 'div', className: 'umap-singleresult' }) - ) + const el = Utils.loadTemplate('
') + this.input.parentNode.insertBefore(el, this.input.nextSibling) + return el } displaySelected(result) { @@ -322,10 +322,9 @@ export const SingleMixin = (Base) => export const MultipleMixin = (Base) => class extends Base { initSelectedContainer() { - return DomUtil.after( - this.input, - DomUtil.element({ tagName: 'ul', className: 'umap-multiresult' }) - ) + const el = Utils.loadTemplate('') + this.input.parentNode.insertBefore(el, this.input.nextSibling) + return el } displaySelected(result) { diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index 38441fb4..695c6d85 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -128,16 +128,6 @@ L.DomUtil.element = ({ tagName, parent, ...attrs }) => { return el } -L.DomUtil.before = (target, el) => { - target.parentNode.insertBefore(el, target) - return el -} - -L.DomUtil.after = (target, el) => { - target.parentNode.insertBefore(el, target.nextSibling) - return el -} - // From https://gist.github.com/Accudio/b9cb16e0e3df858cef0d31e38f1fe46f // convert colour in range 0-255 to the modifier used within luminance calculation L.DomUtil.colourMod = (colour) => {