svgdom
Version:
Straightforward DOM implementation for SVG, HTML and XML
26 lines (20 loc) • 527 B
JavaScript
import { Node } from './Node.js'
import { html } from '../utils/namespaces.js'
export class Attr extends Node {
constructor (name, props, ns) {
super(name, { nodeValue: '', ...props }, ns)
// Follow spec and lowercase nodeName for html
this.nodeName = ns === html ? name.toLowerCase() : name
this.nodeType = Node.ATTRIBUTE_NODE
this.ownerElement = null
}
get value () {
return this.nodeValue
}
set value (val) {
this.nodeValue = val
}
get name () {
return this.nodeName
}
}