dom-fragment.js 876 B

12345678910111213141516171819202122232425262728
  1. var DOMElement = require("./dom-element.js")
  2. module.exports = DocumentFragment
  3. function DocumentFragment(owner) {
  4. if (!(this instanceof DocumentFragment)) {
  5. return new DocumentFragment()
  6. }
  7. this.childNodes = []
  8. this.parentNode = null
  9. this.ownerDocument = owner || null
  10. }
  11. DocumentFragment.prototype.type = "DocumentFragment"
  12. DocumentFragment.prototype.nodeType = 11
  13. DocumentFragment.prototype.nodeName = "#document-fragment"
  14. DocumentFragment.prototype.appendChild = DOMElement.prototype.appendChild
  15. DocumentFragment.prototype.replaceChild = DOMElement.prototype.replaceChild
  16. DocumentFragment.prototype.removeChild = DOMElement.prototype.removeChild
  17. DocumentFragment.prototype.toString =
  18. function _DocumentFragment_toString() {
  19. return this.childNodes.map(function (node) {
  20. return String(node)
  21. }).join("")
  22. }