CSSPseudoElement: type プロパティ

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

typeCSSPseudoElement インターフェイスの読み取り専用プロパティで、擬似要素の型を CSS セレクターの形の文字列で表します。

以下の値のいずれかを格納する文字列です。

下記の例は、 CSSPseudoElement.typeElement.pseudo() の関係を示しています。

js
const myElement = document.querySelector("q");
const mySelector = "::after";
const cssPseudoElement = myElement.pseudo(mySelector);
const typeOfPseudoElement = cssPseudoElement.type;

console.log(mySelector === typeOfPseudoElement); // true を出力

仕様書

Specification
CSS Pseudo-Elements Module Level 4
# dom-csspseudoelement-type

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
type
Experimental

Legend

Tip: you can click/tap on a cell for more information.

No support
No support
Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.

関連情報