Every line of 'document body appendchild' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
1451 function documentCreateElement(tagName, attribute, styles) { 1452 var element, style; 1453 element = document.createElement(tagName); 1454 style = element.style; 1455 1456 attribute && each(attribute, function (value, key) { 1457 element[key] = value; 1458 }); 1459 1460 style && styles && each(styles, function (value, key) { 1461 style[key] = value; 1462 }); 1463 1464 return element; 1465 }
1 export function appendToBody(el) { 2 el.className = "aa"; 3 document.body.appendChild(el); 4 }
76 this.items.forEach(function appendChild(i) {docfrag.appendChild(i.dom);});
106 append ({element}) { 107 this.element.appendChild(element) 108 }
64 export function createEmptyDocument() { 65 const document = DOMImplementationRegistry 66 .getDOMImplementation() 67 .createDocument(); 68 69 document.extra = {}; 70 71 // eslint-disable-next-line no-plusplus 72 for (let i = document.childNodes.length; i; i--) { 73 document.removeChild(document.childNodes.item(i - 1)); 74 } 75 76 return document; 77 }
164 function createElement(html) { 165 var div = document.createElement('div'); 166 div.innerHTML = html; 167 return div.firstChild; 168 }
1 export default function htmlToElement(document, html) { 2 const template = document.createElement('template'); 3 template.innerHTML = html; 4 return template.content.firstChild; 5 }
122 get documentElement() { 123 return this._node 124 }
60 createHTMLDocument(title) { 61 // Let doc be a new document that is an HTML document. 62 // Set doc's content type to "text/html". 63 const document = Document.createImpl([], { 64 options: { parsingMode: "html", encoding: "UTF-8" } 65 }); 66 67 // Create a doctype, with "html" as its name and with its node document set 68 // to doc. Append the newly created node to doc. 69 const doctype = DocumentType.createImpl([], { 70 ownerDocument: this, 71 name: "html", 72 publicId: "", 73 systemId: "" 74 }); 75 76 document.appendChild(doctype); 77 78 // Create an html element in the HTML namespace, and append it to doc. 79 const htmlElement = document.createElementNS(HTML_NS, "html"); 80 document.appendChild(htmlElement); 81 82 // Create a head element in the HTML namespace, and append it to the html 83 // element created in the previous step. 84 const headElement = document.createElement("head"); 85 htmlElement.appendChild(headElement); 86 87 // If the title argument is not omitted: 88 if (title !== undefined) { 89 // Create a title element in the HTML namespace, and append it to the head 90 // element created in the previous step. 91 const titleElement = document.createElement("title"); 92 headElement.appendChild(titleElement); 93 94 // Create a Text node, set its data to title (which could be the empty 95 // string), and append it to the title element created in the previous step. 96 titleElement.appendChild(document.createTextNode(title)); 97 } 98 99 // Create a body element in the HTML namespace, and append it to the html 100 // element created in the earlier step. 101 htmlElement.appendChild(document.createElement("body")); 102 103 // doc's origin is an alias to the origin of the context object's associated 104 // document, and doc's effective script origin is an alias to the effective 105 // script origin of the context object's associated document. 106 107 return document; 108 }
493 function createDocumentFragment( 494 doc 495 ) 496 { 497 /* 498 Public wrapper method for 499 `createDocumentFragment`; returns 500 the wrapper method's result or 501 `null` if not applicable. 502 */ 503 var isDocument = isDocumentNode(doc), 504 key = "createDocumentFragment", 505 isHostObject, 506 result = null; 507 if (isDocument) { 508 isHostObject = Utils.host.isObject( 509 doc[key] 510 ); 511 if (isHostObject) { 512 result = doc[key](); 513 } 514 } 515 return result; 516 }