import namespace_default from "../namespace.js";
function attrRemove(e) {
	return function() {
		this.removeAttribute(e);
	};
}
function attrRemoveNS(e) {
	return function() {
		this.removeAttributeNS(e.space, e.local);
	};
}
function attrConstant(e, a) {
	return function() {
		this.setAttribute(e, a);
	};
}
function attrConstantNS(e, a) {
	return function() {
		this.setAttributeNS(e.space, e.local, a);
	};
}
function attrFunction(e, a) {
	return function() {
		var o = a.apply(this, arguments);
		o == null ? this.removeAttribute(e) : this.setAttribute(e, o);
	};
}
function attrFunctionNS(e, a) {
	return function() {
		var o = a.apply(this, arguments);
		o == null ? this.removeAttributeNS(e.space, e.local) : this.setAttributeNS(e.space, e.local, o);
	};
}
function attr_default(s, c) {
	var l = namespace_default(s);
	if (arguments.length < 2) {
		var u = this.node();
		return l.local ? u.getAttributeNS(l.space, l.local) : u.getAttribute(l);
	}
	return this.each((c == null ? l.local ? attrRemoveNS : attrRemove : typeof c == "function" ? l.local ? attrFunctionNS : attrFunction : l.local ? attrConstantNS : attrConstant)(l, c));
}
export { attr_default as default };
