MCPcopy
hub / github.com/adobe-webplatform/Snap.svg / $

Function $

demos/snap-ad/site/js/main.js:844–877  ·  view source on GitHub ↗
(el, attr)

Source from the content-addressed store, hash-verified

842 };
843
844function $(el, attr) {
845 if (attr) {
846 if (typeof el == "string") {
847 el = $(el);
848 }
849 if (typeof attr == "string") {
850 if (attr.substring(0, 6) == "xlink:") {
851 return el.getAttributeNS(xlink, attr.substring(6));
852 }
853 if (attr.substring(0, 4) == "xml:") {
854 return el.getAttributeNS(xmlns, attr.substring(4));
855 }
856 return el.getAttribute(attr);
857 }
858 for (var key in attr) if (attr[has](key)) {
859 var val = Str(attr[key]);
860 if (val) {
861 if (key.substring(0, 6) == "xlink:") {
862 el.setAttributeNS(xlink, key.substring(6), val);
863 } else if (key.substring(0, 4) == "xml:") {
864 el.setAttributeNS(xmlns, key.substring(4), val);
865 } else {
866 el.setAttribute(key, val);
867 }
868 } else {
869 el.removeAttribute(key);
870 }
871 }
872 } else {
873 el = glob.doc.createElementNS(xmlns, el);
874 // el.style && (el.style.webkitTapHighlightColor = "rgba(0,0,0,0)");
875 }
876 return el;
877}
878Snap._.$ = $;
879Snap._.id = ID;
880function getAttrs(el) {

Callers 15

unit2pxFunction · 0.70
getWFunction · 0.70
getHFunction · 0.70
main.jsFile · 0.70
urltestFunction · 0.70
linktestFunction · 0.70
fixidsFunction · 0.70
makeFunction · 0.70
PaperFunction · 0.70
GaddStopFunction · 0.70
GgetBBoxFunction · 0.70
gradientFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected