import { isObject, each, isNull, isNotNull } from "../../2.base"; export const registAttrFun = Element => { Element.registerFunction("attr", function (key, value) { if (isObject(key)) { each(key, (k, v) => { this.attr(k, v); }); return this; } if (isNull(value)) { return this.attribs[key]; } this.attribs[key] = value; return this; }); Element.registerFunction("hasAttrib", function (key) { return isNotNull(this.attribs[key]); }); Element.registerFunction("removeAttr", function (key) { delete this.attribs[key]; }); };