MCPcopy Index your code
hub / github.com/spritejs/spritejs / attr

Method attr

src/node/node.js:226–241  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

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();

Callers 1

setAttributeMethod · 0.95

Calls 5

setAttributeMethod · 0.95
getAttributeMethod · 0.95
endMethod · 0.95
attrMethod · 0.65
animateMethod · 0.45

Tested by

no test coverage detected