UNPKG

xmlapi-libxmljs

Version:
42 lines (41 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const xmlapi_1 = require("xmlapi"); const utils_1 = require("xmlapi/utils"); class LibxmljsAttribute extends xmlapi_1.AbstractAttribute { constructor(wrapee) { super(); this.wrapee = wrapee; } namespaceUri() { let ns = this.wrapee.namespace(); if (ns) { return ns.href(); } return null; } namespacePrefix() { let ns = this.wrapee.namespace(); if (ns) { return ns.prefix(); } return null; } nameLocal() { return this.wrapee.name(); } namePrefixed() { let ns = this.wrapee.namespace(); if (ns && ns.prefix()) { return ns.prefix() + ':' + this.nameLocal(); } return this.nameLocal(); } value() { return this.wrapee.value().toString(); } equals(other) { return !utils_1.isOddball(other) && other.wrapee === this.wrapee; } } exports.LibxmljsAttribute = LibxmljsAttribute;