Advertisement
Pauan

SJS new appendContent

Oct 5th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. exports.sym_appendHTMLFragment = @Symbol("appendHTMLFragment")
  2.  
  3. exports.appendHTMLFragment = function (x, node) {
  4.   if (Array.isArray(x)) {
  5.     array ..@each(function (x) {
  6.       exports.appendHTMLFragment(x, node)
  7.     })
  8.   } else if (typeof x === "string") {
  9.     node.appendChild(document.createTextNode(escapeString(x)))
  10.   } else if (x != null) {
  11.     x[sym_appendHTMLFragment](x, node)
  12.   }
  13. }
  14.  
  15. exports.appendContent = function (dom, fragment, block) {
  16.   appendHTMLFragment(fragment, dom)
  17.  
  18.   // Handle other stuff, like block
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement