(...args)
| 224 | } |
| 225 | |
| 226 | attr(...args) { |
| 227 | if(args.length === 0) return this.attributes[attributes]; |
| 228 | if(args.length > 1) { |
| 229 | let [key, value] = args; |
| 230 | if(typeof value === 'function') { |
| 231 | value = value(this.attr(key)); |
| 232 | } |
| 233 | this.setAttribute(key, value); |
| 234 | return this; |
| 235 | } |
| 236 | if(typeof args[0] === 'string') { |
| 237 | return this.getAttribute(args[0]); |
| 238 | } |
| 239 | Object.assign(this.attributes, args[0]); |
| 240 | return this; |
| 241 | } |
| 242 | |
| 243 | cloneNode() { |
| 244 | const cloned = new this.constructor(); |
no test coverage detected