<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><section><h1>仕様書</h1><refs xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:"><ul xmlns="http://www.w3.org/1999/xhtml"><li><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="8" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[8]</anchor-end> <cite xml:lang="en">DOM Standard</cite> (<time>2015-05-08 20:08:36 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dom.spec.whatwg.org/#concept-node-replace">https://dom.spec.whatwg.org/#concept-node-replace</anchor-external></li><li><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="9" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[9]</anchor-end> <cite xml:lang="en">DOM Standard</cite> (<time>2015-05-08 20:08:36 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dom.spec.whatwg.org/#concept-node-replace-all">https://dom.spec.whatwg.org/#concept-node-replace-all</anchor-external></li><li><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="10" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[10]</anchor-end> <cite xml:lang="en">DOM Standard</cite> (<time>2015-05-08 20:08:36 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dom.spec.whatwg.org/#dom-node-replacechildnode-child">https://dom.spec.whatwg.org/#dom-node-replacechildnode-child</anchor-external></li><li><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="12" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[12]</anchor-end> <cite xml:lang="en">DOM Standard</cite> (<time>2015-05-08 20:08:36 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dom.spec.whatwg.org/#dom-childnode-replacewithnodes">https://dom.spec.whatwg.org/#dom-childnode-replacewithnodes</anchor-external></li></ul></refs></section><section><h1>すべて置換</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="19" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[19]</anchor-end> <code>document.open</code> では、<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">変異イベント無効</anchor>で呼び出されます。</p></section><section><h1>歴史</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="1" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[1]</anchor-end>
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準1</anchor> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">SE</anchor> と<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準2</anchor>と<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準3</anchor>によれば、
<code class="DOMp" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">newChild</anchor></code> の <code class="DOMa" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">parentNode</anchor></code>
が<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">読取専用</anchor>なら <code class="DOMc" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">NO_MODIFICATION_ALLOWED_ERR</anchor></code> となります。
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">名無しさん</anchor>)</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="2" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[2]</anchor-end></p><p><code class="DOMa" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">ownerDocument</anchor></code> が
<code class="IDL" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">nullll</anchor></code>
の <code class="DOMi" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DocumentType</anchor></code>
を <code class="DOMp" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">newChild</anchor></code> としたときどうなるのかよくわかりません。
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">名無しさん</anchor>)</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="3" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[3]</anchor-end>
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準1</anchor> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">SE</anchor> と <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準2</anchor>と<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準3</anchor>によれば
<code class="DOMi" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DocumentFragment</anchor></code> とすると、
<code class="DOMp" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">oldChild</anchor></code> は
<code class="DOMi" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DocumentFragment</anchor></code>
の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">子供</anchor>達 (そのままの<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">順序</anchor>) により置き換えられます。
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">名無しさん</anchor>)</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="4" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[4]</anchor-end>
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準3</anchor>によると自分自身を置換しようとしたら結果は<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">実装依存</anchor>です。
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">名無しさん</anchor>)</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="5" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[5]</anchor-end>
<code class="DOMi" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">Document</anchor></code> の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">子供</anchor>の扱いについては
<code class="DOMm" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">appendChild</anchor></code> を参照。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="6" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[6]</anchor-end>
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準2</anchor><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">正誤表</anchor>と<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">DOM水準3</anchor>によると自分に自分を
<code class="DOMm" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">appendChild</anchor></code> しようとしたら
<code class="DOMc" xml:lang="en"><anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">HIERARCHY_REQUEST_ERR</anchor></code> です。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="206" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[206]</anchor-end> <cite>Issue 255482 - chromium - DOM4: prepend, append, before, after &amp; replace - An open-source project to help move the web forward. - Google Project Hosting</cite>
( (<time>2014-11-26 12:42:46 +09:00</time> 版))
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://code.google.com/p/chromium/issues/detail?id=255482">https://code.google.com/p/chromium/issues/detail?id=255482</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="207" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[207]</anchor-end> <cite xml:lang="en">911477 – Implement DOM4 methods: prepend(), append(), before(), after() and replace()</cite>
( (<time>2014-11-26 12:43:36 +09:00</time> 版))
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://bugzilla.mozilla.org/show_bug.cgi?id=911477">https://bugzilla.mozilla.org/show_bug.cgi?id=911477</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="208" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[208]</anchor-end> <cite xml:lang="en">Mark new APIs as <strong></strong>[<strong></strong>Unscopeable<strong></strong>]<strong></strong> https://www.w3.org/Bugs/Public/show_bug.c... · b2eb25f · whatwg/dom</cite>
( (<time>2014-11-27 20:47:53 +09:00</time> 版))
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/dom/commit/b2eb25f751cb71a6ffacebe714c27667d3591e6b">https://github.com/whatwg/dom/commit/b2eb25f751cb71a6ffacebe714c27667d3591e6b</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="11" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[11]</anchor-end> <cite xml:lang="en">Rename replace() to replaceWith() · b7563aa · whatwg/dom</cite> (<time>2015-01-15 11:43:22 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/dom/commit/b7563aaf0864c8d104d18c36a9eda036c5205131">https://github.com/whatwg/dom/commit/b7563aaf0864c8d104d18c36a9eda036c5205131</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="7" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[7]</anchor-end> <cite xml:lang="en">Need to grab children of a DocumentFragment before an insert. Fixes h… · whatwg/dom@1b9e2f9</cite>
(<time>2015-05-30 23:37:04 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/dom/commit/1b9e2f9765884460410d1396dbba99951eafe838">https://github.com/whatwg/dom/commit/1b9e2f9765884460410d1396dbba99951eafe838</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="13" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[13]</anchor-end> <cite xml:lang="en">Do not remove child from its parent when replacing a node by itself · whatwg/dom@c20e4b5</cite>
(<time>2015-12-03 22:46:43 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/dom/commit/c20e4b558535b81cb5b36e77ab6ed12a102d0a00">https://github.com/whatwg/dom/commit/c20e4b558535b81cb5b36e77ab6ed12a102d0a00</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="14" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[14]</anchor-end> <cite xml:lang="en">Close #128: fix a typo in the replace a node algorithm · whatwg/dom@f2b2a22</cite>
(<time>2015-12-16 12:16:22 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/dom/commit/f2b2a221ddc9022988fc6ab7a73fce7a0d0d0071">https://github.com/whatwg/dom/commit/f2b2a221ddc9022988fc6ab7a73fce7a0d0d0071</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="15" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[15]</anchor-end> <cite xml:lang="en">Editorial: synchronize with the DOM Standard · whatwg/html@21c6ec7</cite>
(<time>2016-03-20 18:02:25 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/html/commit/21c6ec77594eb89b836d4872222f5916910967fd">https://github.com/whatwg/html/commit/21c6ec77594eb89b836d4872222f5916910967fd</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="16" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[16]</anchor-end> <cite xml:lang="en">Add <strong></strong>[<strong></strong>CEReactions<strong></strong>]<strong></strong> annotations to mutating methods · whatwg/dom@3cd02d1</cite>
(<time>2016-04-26 19:06:35 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/dom/commit/3cd02d139c159a31fbb400e03932652c72fc7812">https://github.com/whatwg/dom/commit/3cd02d139c159a31fbb400e03932652c72fc7812</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="17" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[17]</anchor-end> <cite xml:lang="en">Add <strong></strong>[<strong></strong>CEReactions<strong></strong>]<strong></strong> annotations to mutating methods · whatwg/dom@3cd02d1</cite>
(<time>2016-04-26 19:07:28 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/dom/commit/3cd02d139c159a31fbb400e03932652c72fc7812">https://github.com/whatwg/dom/commit/3cd02d139c159a31fbb400e03932652c72fc7812</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="18" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[18]</anchor-end> <cite xml:lang="en">Use DOM's &quot;replace all&quot; primitive in document.open()</cite>
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">annevk</anchor>著, <time>2018-05-01 01:44:29 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/html/commit/423c66403522b09138dc3b366bf96111bc030a04">https://github.com/whatwg/html/commit/423c66403522b09138dc3b366bf96111bc030a04</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="20" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[20]</anchor-end> <cite xml:lang="en">Use DOM's &quot;replace all&quot; primitive in document.open() by annevk · Pull Request #3598 · whatwg/html</cite>
(<time>2018-05-03 10:36:20 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/whatwg/html/pull/3598">https://github.com/whatwg/html/pull/3598</anchor-external></p></section></body></html>