CSSStyleValue: parse() 静的メソッド

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

parse()CSSStyleValue インターフェイスのメソッドで、特定の CSS プロパティを指定された値に設定し、最初の値を CSSStyleValue オブジェクトとして返します。

構文

js
CSSStyleValue.parse(property, cssText)

引数

property

設定する CSS プロパティ。

cssText

指定されたプロパティに適用する 1 つ以上の値を含む、カンマで区切られた文字列。

返値

最初に与えられた値を格納した CSSStyleValue オブジェクトです。

下記のコードは transform プロパティに対する一連の宣言を解釈します。 2 つ目のコードブロックは、返されたオブジェクトの構造を、開発者ツールのコンソールに表示したものです。

js
const css = CSSStyleValue.parse(
  "transform",
  "translate3d(10px,10px,0) scale(0.5)",
);
css
CSSTransformValue {0: CSSTranslate, 1: CSSScale, length: 2, is2D: false}

仕様書

Specification
CSS Typed OM Level 1
# dom-cssstylevalue-parse

ブラウザーの互換性

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
parse() static method

Legend

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

Full support
Full support
No support
No support
See implementation notes.

関連情報