html5-utils
Version:
html5 dom utils....
38 lines (36 loc) • 850 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.newTextNode = newTextNode;
exports.newCommentNode = newCommentNode;
exports.newElement = newElement;
function newTextNode(value) {
return {
nodeName: '#text',
value: value,
parentNode: undefined,
attrs: [],
__location: undefined
};
}
function newCommentNode(comment) {
return {
nodeName: '#comment',
data: comment,
parentNode: undefined,
attrs: [],
__location: undefined
};
}
function newElement(tagName, namespace) {
return {
nodeName: tagName,
tagName: tagName,
childNodes: [],
namespaceURI: namespace || 'http://www.w3.org/1999/xhtml',
attrs: [],
parentNode: undefined,
__location: undefined
};
}