MCPcopy Create free account
hub / github.com/idank/explainshell / d3_selection_attr

Function d3_selection_attr

explainshell/web/static/js/d3.v3.js:641–664  ·  view source on GitHub ↗
(name, value)

Source from the content-addressed store, hash-verified

639 return this.each(d3_selection_attr(name, value));
640 };
641 function d3_selection_attr(name, value) {
642 name = d3.ns.qualify(name);
643 function attrNull() {
644 this.removeAttribute(name);
645 }
646 function attrNullNS() {
647 this.removeAttributeNS(name.space, name.local);
648 }
649 function attrConstant() {
650 this.setAttribute(name, value);
651 }
652 function attrConstantNS() {
653 this.setAttributeNS(name.space, name.local, value);
654 }
655 function attrFunction() {
656 var x = value.apply(this, arguments);
657 if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
658 }
659 function attrFunctionNS() {
660 var x = value.apply(this, arguments);
661 if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
662 }
663 return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
664 }
665 function d3_collapse(s) {
666 return s.trim().replace(/\s+/g, " ");
667 }

Callers 1

d3.v3.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected