이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!
The Range.createContextualFragment()
method returns a DocumentFragment
by invoking the HTML fragment parsing algorithm or the XML fragment parsing algorithm with the start of the range (the parent of the selected node) as the context node. The HTML fragment parsing algorithm is used if the range belongs to a Document
whose HTMLness bit is set. In the HTML case, if the context node would be html
, for historical reasons the fragment parsing algorithm is invoked with body
as the context instead.
Syntax
documentFragment = range.createContextualFragment( tagString )
Parameters
- tagString
- Text that contains text and tags to be converted to a document fragment.
Example
var tagString = "<div>I am a div node</div>"; var range = document.createRange(); // make the parent of the first div in the document becomes the context node range.selectNode(document.getElementsByTagName("div").item(0)); var documentFragment = range.createContextualFragment(tagString); document.body.appendChild(documentFragment);
Specification
Specification | Status | Comment |
---|---|---|
DOM Parsing and Serialization The definition of 'Range.createContextualFragment()' in that specification. |
Working Draft | Initial specification. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 11 | 15.0 | 9.1.2 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | No support | 15.0 | ? |
See also
문서 태그 및 공헌자
태그:
이 페이지의 공헌자:
paul.irish,
IceCreamYou,
-munawwar-,
teoli,
fscholz,
Prome,
gtibrett,
kscarfone,
Sheppy,
Hsivonen,
Ms2ger,
Ptak82,
WcfDdg,
Andreas Wuest,
Paul Sowden,
Gor1
최종 변경:
paul.irish,