chore: remove DomUtil.after/before

This commit is contained in:
Yohan Boniface 2025-04-23 16:50:13 +02:00
parent 60ac4b35f2
commit 7991d6cdbe
2 changed files with 7 additions and 18 deletions

View file

@ -7,6 +7,7 @@ import {
import { translate } from './i18n.js' import { translate } from './i18n.js'
import { Request, ServerRequest } from './request.js' import { Request, ServerRequest } from './request.js'
import { escapeHTML, generateId } from './utils.js' import { escapeHTML, generateId } from './utils.js'
import * as Utils from './utils.js'
export class BaseAutocomplete { export class BaseAutocomplete {
constructor(parent, options) { constructor(parent, options) {
@ -291,10 +292,9 @@ class BaseServerAjax extends BaseAjax {
export const SingleMixin = (Base) => export const SingleMixin = (Base) =>
class extends Base { class extends Base {
initSelectedContainer() { initSelectedContainer() {
return DomUtil.after( const el = Utils.loadTemplate('<div class="umap-singleresult"></div>')
this.input, this.input.parentNode.insertBefore(el, this.input.nextSibling)
DomUtil.element({ tagName: 'div', className: 'umap-singleresult' }) return el
)
} }
displaySelected(result) { displaySelected(result) {
@ -322,10 +322,9 @@ export const SingleMixin = (Base) =>
export const MultipleMixin = (Base) => export const MultipleMixin = (Base) =>
class extends Base { class extends Base {
initSelectedContainer() { initSelectedContainer() {
return DomUtil.after( const el = Utils.loadTemplate('<ul class="umap-multiresult"></ul>')
this.input, this.input.parentNode.insertBefore(el, this.input.nextSibling)
DomUtil.element({ tagName: 'ul', className: 'umap-multiresult' }) return el
)
} }
displaySelected(result) { displaySelected(result) {

View file

@ -128,16 +128,6 @@ L.DomUtil.element = ({ tagName, parent, ...attrs }) => {
return el 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 // From https://gist.github.com/Accudio/b9cb16e0e3df858cef0d31e38f1fe46f
// convert colour in range 0-255 to the modifier used within luminance calculation // convert colour in range 0-255 to the modifier used within luminance calculation
L.DomUtil.colourMod = (colour) => { L.DomUtil.colourMod = (colour) => {