MCPcopy
hub / github.com/bendc/sprint / createDOM

Function createDOM

sprint.js:55–74  ·  view source on GitHub ↗
(HTMLString)

Source from the content-addressed store, hash-verified

53 }())
54
55 var createDOM = function(HTMLString) {
56 var tmp = document.createElement("div")
57 var tag = /[\w:-]+/.exec(HTMLString)[0]
58 var inMap = wrapMap[tag]
59 var validHTML = HTMLString.trim()
60 if (inMap) {
61 validHTML = inMap.intro + validHTML + inMap.outro
62 }
63 tmp.insertAdjacentHTML("afterbegin", validHTML)
64 var node = tmp.lastChild
65 if (inMap) {
66 var i = inMap.outro.match(/</g).length
67 while (i--) {
68 node = node.lastChild
69 }
70 }
71 // prevent tmp to be node's parentNode
72 tmp.textContent = ""
73 return node
74 }
75
76 var domMethods = {
77 afterbegin: function(el) {

Callers 1

InitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected