diff options
author | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-07-30 12:20:44 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-30 12:20:44 +0900 |
commit | 23a139d3fc66b31df0c0c26885c98db3caadfdb0 (patch) | |
tree | 95b4df852d845b399adc9577ded8a0ab27893dc5 /files/ja/web/api/element | |
parent | 9954d151cc16c4906d2d782ef5758170f47569a5 (diff) | |
download | translated-content-23a139d3fc66b31df0c0c26885c98db3caadfdb0.tar.gz translated-content-23a139d3fc66b31df0c0c26885c98db3caadfdb0.tar.bz2 translated-content-23a139d3fc66b31df0c0c26885c98db3caadfdb0.zip |
ChildNode/remove を各インターフェイスに分割 (#1584)
Diffstat (limited to 'files/ja/web/api/element')
-rw-r--r-- | files/ja/web/api/element/remove/index.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/files/ja/web/api/element/remove/index.html b/files/ja/web/api/element/remove/index.html new file mode 100644 index 0000000000..4c75a0bf52 --- /dev/null +++ b/files/ja/web/api/element/remove/index.html @@ -0,0 +1,54 @@ +--- +title: Element.remove() +slug: Web/API/Element/remove +tags: + - API + - Element + - DOM + - Method +browser-compat: api.Element.remove +translation_of: Web/API/Element/remove +--- +<div>{{APIRef("DOM")}}</div> + +<p><code><strong>Element.remove()</strong></code> は所属するツリーから要素を削除します。</p> + +<h2 id="Syntax">構文</h2> + +<pre class="brush: js">remove()</pre> + +<h2 id="Example">例</h2> + +<h3 id="Using_remove"><code>remove()</code> の使用</h3> + +<pre class="brush: html"><div id="div-01">Here is div-01</div> +<div id="div-02">Here is div-02</div> +<div id="div-03">Here is div-03</div> +</pre> + +<pre class="brush: js">var el = document.getElementById('div-02'); +el.remove(); // 'div-02' の id を持った div を削除 +</pre> + +<h3 id="Element.remove_is_unscopable"><code>Element.remove()</code> はスコープ化に非対応</h3> + +<p><code>remove()</code> メソッドは <code>with</code> 文によるスコープ化に対応していません。 詳細は {{jsxref("Symbol.unscopables")}} を参照してください。</p> + +<pre class="brush: js">with(node) { + remove(); +} +// ReferenceError: remove is not defined </pre> + +<h2 id="Specifications">仕様書</h2> + +{{Specifications}} + +<h2 id="Browser_compatibility">ブラウザーの互換性</h2> + +<p>{{Compat}}</p> + +<h2 id="See_also">関連情報</h2> + +<ul> + <li><a href="https://github.com/chenzhenxi/element-remove">ポリフィル</a></li> +</ul> |