ToggleEvent: newState プロパティ
Baseline 2025Newly available
Since January 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
newState
は ToggleEvent
インターフェイスの読み取り専用プロパティで、この要素が遷移した後の状態を表す文字列です。
値
文字列です。取りうる値は "open"
(ポップオーバーが表示されている)または "closed"
(ポップオーバーが非表示になっている)です。
例
js
const popover = document.getElementById("mypopover");
// ...
popover.addEventListener("beforetoggle", (event) => {
if (event.newState === "open") {
console.log("Popover is being shown");
} else {
console.log("Popover is being hidden");
}
});
仕様書
Specification |
---|
HTML # dom-toggleevent-newstate |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
newState |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.