Fix performance for very large number of options
This commit is contained in:
parent
3b85734049
commit
360e34e1fc
2 changed files with 11 additions and 5 deletions
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "@darkwiiplayer/better-select",
|
"name": "@darkwiiplayer/better-select",
|
||||||
"module": "BetterSelect.js",
|
"browser": "src/BetterSelect.js",
|
||||||
"type": "module"
|
"type": "module",
|
||||||
|
"license": "MIT",
|
||||||
|
"version": "1.0.2",
|
||||||
|
"url": "https://darkwiiplayer.github.io/BetterSelect/"
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,13 @@ const css = template(string => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const childObserver = new MutationObserver(mutations => {
|
const childObserver = new MutationObserver(mutations => {
|
||||||
for (const mutation of mutations) {
|
const targets = new Set()
|
||||||
if (mutation.target instanceof BetterSelect)
|
for (const {target} of mutations) {
|
||||||
mutation.target.mutationCallback()
|
if (target instanceof BetterSelect)
|
||||||
|
targets.add(target)
|
||||||
}
|
}
|
||||||
|
for (const target of targets)
|
||||||
|
target.mutationCallback()
|
||||||
})
|
})
|
||||||
|
|
||||||
export class BetterSelect extends HTMLElement {
|
export class BetterSelect extends HTMLElement {
|
||||||
|
|
Loading…
Reference in a new issue