mirror of
https://github.com/tridactyl/tridactyl.git
synced 2026-09-10 07:16:33 -04:00
Merge branch 'optimize-completion-dom-updates'
This commit is contained in:
commit
0f0aaef006
|
|
@ -304,14 +304,8 @@ export abstract class CompletionSourceFuse extends CompletionSource {
|
|||
|
||||
/** Call to replace the current display */
|
||||
updateDisplay() {
|
||||
const fragment = document.createDocumentFragment()
|
||||
for (const option of this.options) {
|
||||
if (option.state !== "hidden") {
|
||||
fragment.appendChild(option.html)
|
||||
}
|
||||
}
|
||||
this.optionContainer.innerHTML = ""
|
||||
this.optionContainer.appendChild(fragment)
|
||||
const visibleOptions = this.options.filter(o => o.state !== "hidden").map(o => o.html)
|
||||
this.optionContainer.replaceChildren(...visibleOptions)
|
||||
this.next(0)
|
||||
}
|
||||
|
||||
|
|
|
|||
3
src/tridactyl.d.ts
vendored
3
src/tridactyl.d.ts
vendored
|
|
@ -59,6 +59,9 @@ interface HTMLElement {
|
|||
// Let's be future proof:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
||||
focus(options?: any): void
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren
|
||||
replaceChildren(...nodes: Node[]): void
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/ban-types */
|
||||
|
|
|
|||
Loading…
Reference in a new issue