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",
|
||||
"module": "BetterSelect.js",
|
||||
"type": "module"
|
||||
"browser": "src/BetterSelect.js",
|
||||
"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 => {
|
||||
for (const mutation of mutations) {
|
||||
if (mutation.target instanceof BetterSelect)
|
||||
mutation.target.mutationCallback()
|
||||
const targets = new Set()
|
||||
for (const {target} of mutations) {
|
||||
if (target instanceof BetterSelect)
|
||||
targets.add(target)
|
||||
}
|
||||
for (const target of targets)
|
||||
target.mutationCallback()
|
||||
})
|
||||
|
||||
export class BetterSelect extends HTMLElement {
|
||||
|
|
Loading…
Reference in a new issue