aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/element/replacewith
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2021-07-19 14:36:49 -0400
committerGitHub <noreply@github.com>2021-07-19 11:36:49 -0700
commit49c5601989809c347a5a595e3c5edc08731e5305 (patch)
treec6f1c1f2261d3e7f38eb0ba7214e6699f7faf886 /files/zh-cn/web/api/element/replacewith
parent6e56eb90c0ce1d75dafc66151c4863f2b1a11fdc (diff)
downloadtranslated-content-49c5601989809c347a5a595e3c5edc08731e5305.tar.gz
translated-content-49c5601989809c347a5a595e3c5edc08731e5305.tar.bz2
translated-content-49c5601989809c347a5a595e3c5edc08731e5305.zip
Remove previously orphaned file (#1616)
* remove previously orphaned file * rid of more * remove one more * remove more * another one * delete more
Diffstat (limited to 'files/zh-cn/web/api/element/replacewith')
-rw-r--r--files/zh-cn/web/api/element/replacewith/index.html112
1 files changed, 0 insertions, 112 deletions
diff --git a/files/zh-cn/web/api/element/replacewith/index.html b/files/zh-cn/web/api/element/replacewith/index.html
deleted file mode 100644
index 9f3ef5bd88..0000000000
--- a/files/zh-cn/web/api/element/replacewith/index.html
+++ /dev/null
@@ -1,112 +0,0 @@
----
-title: ChildNode.replaceWith()
-slug: orphaned/Web/API/ChildNode/replaceWith
-tags:
- - DOM
- - Node
-translation_of: Web/API/ChildNode/replaceWith
-original_slug: Web/API/ChildNode/replaceWith
----
-<div>{{APIRef("DOM")}} {{SeeCompatTable}}</div>
-
-<p><code><strong>ChildNode</strong></code><strong><code>.replaceWith()</code></strong> 的方法用一套 {{domxref("Node")}} 对象或者 {{domxref("DOMString")}} 对象,替换了该节点父节点下的子节点 。{{domxref("DOMString")}} 对象被当做等效的{{domxref("Text")}} 节点插入。</p>
-
-<h2 id="语法">语法</h2>
-
-<pre class="syntaxbox">[Throws, Unscopable]
-void ChildNode.replaceWith((Node or DOMString)... nodes);
-</pre>
-
-<h3 id="参数">参数</h3>
-
-<dl>
- <dt><code>节点</code></dt>
- <dd>一系列用来替换的{{domxref("Node")}} 对象或者 {{domxref("DOMString")}} 对象。</dd>
-</dl>
-
-<h3 id="例外">例外</h3>
-
-<ul>
- <li>{{domxref("HierarchyRequestError")}}: 无法在层次结构中的指定点插入节点。</li>
-</ul>
-
-<h2 id="案例">案例</h2>
-
-<h3 id="Using_replaceWith">Using <code>replaceWith()</code></h3>
-
-<pre class="brush: js">var parent = document.createElement("div");
-var child = document.createElement("p");
-parent.appendChild(child);
-var span = document.createElement("span");
-
-child.replaceWith(span);
-
-console.log(parent.outerHTML);
-// "&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;"
-</pre>
-
-<h3 id="ChildNode.replaceWith_is_unscopable"><code>ChildNode.replaceWith()</code> is unscopable</h3>
-
-<p><code>replaceWith()</code>的方法并没有作用于with语句. 参考 {{jsxref("Symbol.unscopables")}} 获取更多信息.</p>
-
-<pre class="brush: js">with(node) {
- replaceWith("foo");
-}
-// ReferenceError: replaceWith is not defined </pre>
-
-<h2 id="Polyfill">Polyfill</h2>
-
-<p>你可以在IE9及更高级的浏览器中使用下面的代码向上兼容<code>replaceWith()</code>的方法:</p>
-
-<pre class="brush: js">(function (arr) {
- arr.forEach(function (item) {
- if (item.hasOwnProperty('replaceWith')) {
- return;
- }
- Object.defineProperty(item, 'replaceWith', {
- configurable: true,
- enumerable: true,
- writable: true,
- value: function replaceWith() {
- var argArr = Array.prototype.slice.call(arguments),
- docFrag = document.createDocumentFragment();
-
- argArr.forEach(function (argItem) {
- var isNode = argItem instanceof Node;
- docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem)));
- });
-
- this.parentNode.replaceChild(docFrag, this);
- }
- });
- });
-})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);</pre>
-
-<h2 id="规范">规范</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">规范</th>
- <th scope="col">状态</th>
- <th scope="col">注释</th>
- </tr>
- <tr>
- <td>{{SpecName('DOM WHATWG', '#dom-childnode-replacewith', 'ChildNode.replacewith()')}}</td>
- <td>{{Spec2('DOM WHATWG')}}</td>
- <td>Initial definition.</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="浏览器兼容性">浏览器兼容性</h2>
-
-<p>{{Compat("api.ChildNode.replaceWith")}}</p>
-
-<h2 id="参阅">参阅</h2>
-
-<ul>
- <li>{{domxref("ChildNode")}} 和 {{domxref("ParentNode")}}</li>
- <li>{{domxref("Node.replaceChild()")}}</li>
- <li>{{domxref("NodeList")}}</li>
-</ul>