CharacterData: insertData() メソッド
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.
insertData()
は CharacterData
インターフェイスのメソッドで、指定されたデータをこの CharacterData
ノードの現在のデータの、既存のデータの先頭からのオフセットの位置に挿入します。
指定されたデータは、既存のデータに継ぎ足されます。
構文
js
characterData.insertData(offset, data)
引数
返値
なし。
例外
IndexSizeError
DOMException
-
offset が負の値であるか、入っているデータの長さよりも大きい場合に発生します。
例
html
<span>結果: </span>A string.
js
const span = document.querySelector("span");
const textnode = span.nextSibling;
textnode.insertData(2, "long ");
仕様書
Specification |
---|
DOM # dom-characterdata-insertdata |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
insertData |
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.