CharacterData: length プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
CharacterData.length
プロパティは読み取り専用で、含まれているデータの文字数を正の整数で返します。
値
正の整数で、 CharacterData.data
文字列の長さを表します。
例
メモ: CharacterData
は抽象インターフェイスです。
以下の例ではそれを実装した具象インターフェイスの一つである Text
を使用しています。
html
<code>Text</code> ノード内の文字列の長さ: <output></output>
js
const output = document.querySelector("output");
const textnode = new Text(
"このテキストは 'textnode.data' を使用して設定されました。",
);
output.value = textnode.length;
仕様書
Specification |
---|
DOM # dom-characterdata-length |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
length |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full 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.