From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/ko/web/api/document/adoptnode/index.html | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 files/ko/web/api/document/adoptnode/index.html (limited to 'files/ko/web/api/document/adoptnode') diff --git a/files/ko/web/api/document/adoptnode/index.html b/files/ko/web/api/document/adoptnode/index.html new file mode 100644 index 0000000000..d2cce901a6 --- /dev/null +++ b/files/ko/web/api/document/adoptnode/index.html @@ -0,0 +1,58 @@ +--- +title: Document.adoptNode() +slug: Web/API/Document/adoptNode +tags: + - API + - DOM + - DOM 레퍼런스 + - 레퍼런스 + - 메소드 +translation_of: Web/API/Document/adoptNode +--- +
{{ ApiRef("DOM") }}
+ +
 
+ +

외부 문서로부터 노드를 가져온다. 해당 노드와 그 하위트리는 기존의 문서에서 지워지고 해당 노드의 ownerDocument 는 현재 문서로 바뀐다. 그리고 그 노드는 현재의 문서에 삽입된다.

+ +

Gecko 1.9 (Firefox 3)부터 지원

+ +

문법

+ +
node = document.adoptNode(externalNode);
+
+ +
+
   node
+
는 현재 문서에 삽입될 노드를 의미. 아직 해당 문서에 삽입되기 전이기 때문에 새로운 노드의 parentNode는 null이다.   
+
externalNode
+
는 노드를 가져오기 위한 외부 문서에 있는 노드를 의미.
+
+ +

예제

+ +

{{todo}}

+ +

알아두기

+ +

보통 adoptNode 호출은 다른 방식으로 구현된 곳에서 노드를 불러오기 때문에 실패하는 경우가 많다. 하지만 브라우저로 인한 문제인 경우는 문제가 된다.

+ +

Nodes from external documents should be cloned using document.importNode() (or adopted using document.adoptNode()) before they + can be inserted into the current document. For more on the Node.ownerDocument issues, see the + W3C DOM FAQ.

+ +

Firefox doesn't currently enforce this rule (it did for a while during the development of Firefox 3, but too many + sites break when this rule is enforced). We encourage Web developers to fix their code to follow this rule for + improved future compatibility.

+ +

명세

+ + + +

더 보기

+ + -- cgit v1.2.3-54-g00ecf