marko/runtime/vdom/VDocumentFragment.js
2017-01-20 13:40:21 -07:00

46 lines
1.0 KiB
JavaScript

var VNode = require('./VNode');
var inherit = require('raptor-util/inherit');
var extend = require('raptor-util/extend');
function VDocumentFragmentClone(other) {
extend(this, other);
this.$__parentNode = undefined;
this.$__nextSibling = undefined;
}
function VDocumentFragment(documentFragment) {
this.$__VNode(null /* childCount */);
this.namespaceURI = undefined;
}
VDocumentFragment.prototype = {
nodeType: 11,
$__DocumentFragment: true,
$__nsAware: true,
$__cloneNode: function() {
return new VDocumentFragmentClone(this);
},
actualize: function(doc) {
var docFragment = doc.createDocumentFragment();
var curChild = this.firstChild;
while(curChild) {
docFragment.appendChild(curChild.actualize(doc));
curChild = curChild.nextSibling;
}
return docFragment;
}
};
inherit(VDocumentFragment, VNode);
VDocumentFragmentClone.prototype = VDocumentFragment.prototype;
module.exports = VDocumentFragment;