Microsoft/TypeScript

Update lib.dom.d.ts: `MutationObserverInit.attributeFilter` can accept an iterator

Open

#55.990 geöffnet am 5. Okt. 2023

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
BugDomain: lib.d.tsHelp Wanted

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

⚙ Compilation target

n/a

⚙ Library

lib.dom

Missing / Incorrect Definition

MutationObserverInit

Sample Code

The following code works in Chredge, Firefox, and Safari:

const obs = new MutationObserver((records) => {
    console.log(...records)
})

const s = new Set(['foo', 'bar'])

obs.observe(document.body, {
  attributeFilter: s.keys() // <--------- HERE
})

document.body.setAttribute('foo', 'foo')
document.body.removeAttribute('foo')
document.body.setAttribute('bar', 'bar')
document.body.removeAttribute('bar')

Edge screenshot:

Documentation Link

https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#parameters

WIP Pull Request

Contributor Guide