CSSNumericValue.parse()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
parse()
は CSSNumericValue
インターフェイスのメソッドで、値の文字列をメンバーが値と単位となっているオブジェクトに変換します。
構文
js
parse(cssText);
引数
cssText
-
数値と単位の部分を持つ文字列です。
返値
CSSNumericValue
です。
例外
SyntaxError
DOMException
-
TBD
例
以下は、unit
プロパティが "px"
で、value
プロパティが 42
である CSSUnitValue
オブジェクトを返すものです。
js
let numValue = CSSNumericValue.parse("42.0px");
仕様書
Specification |
---|
CSS Typed OM Level 1 # dom-cssnumericvalue-parse |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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.
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.