Microsoft/TypeScript

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

Open

#55,990 opened on 2023年10月5日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)TypeScript (6,726 forks)batch import
BugDomain: lib.d.tsHelp Wanted

Repository metrics

Stars
 (48,455 stars)
PR merge metrics
 (平均マージ 6d 17h) (30d で 9 merged PRs)

説明

⚙ 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

コントリビューターガイド