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

Function Paper

demos/snap-ad/site/js/main.js:3204–3240  ·  view source on GitHub ↗
(w, h)

Source from the content-addressed store, hash-verified

3202 return el;
3203}
3204function Paper(w, h) {
3205 var res,
3206 desc,
3207 defs,
3208 proto = Paper.prototype;
3209 if (w && w.tagName == "svg") {
3210 if (w.snap in hub) {
3211 return hub[w.snap];
3212 }
3213 res = new Element(w);
3214 desc = w.getElementsByTagName("desc")[0];
3215 defs = w.getElementsByTagName("defs")[0];
3216 if (!desc) {
3217 desc = $("desc");
3218 desc.appendChild(glob.doc.createTextNode("Created with Snap"));
3219 res.node.appendChild(desc);
3220 }
3221 if (!defs) {
3222 defs = $("defs");
3223 res.node.appendChild(defs);
3224 }
3225 res.defs = defs;
3226 for (var key in proto) if (proto[has](key)) {
3227 res[key] = proto[key];
3228 }
3229 res.paper = res.root = res;
3230 } else {
3231 res = make("svg", glob.doc.body);
3232 $(res.node, {
3233 height: h,
3234 version: 1.1,
3235 width: w,
3236 xmlns: xmlns
3237 });
3238 }
3239 return res;
3240}
3241function wrap(dom) {
3242 if (!dom) {
3243 return dom;

Callers

nothing calls this directly

Calls 2

$Function · 0.70
makeFunction · 0.70

Tested by

no test coverage detected