Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Paper(w, h) {
- var res,
- desc,
- defs,
- proto = Paper.prototype;
- if (w && w.tagName == "svg") {
- if (w.snap in hub) {
- return hub[w.snap];
- }
- var doc = w.ownerDocument;
- res = new Element(w);
- desc = w.getElementsByTagName("desc")[0];
- defs = w.getElementsByTagName("defs")[0];
- /*
- if (!desc) {
- desc = $("desc");
- desc.appendChild(doc.createTextNode("Created with Snap"));
- res.node.appendChild(desc);
- }
- if (!defs) {
- defs = $("defs");
- res.node.appendChild(defs);
- }
- */
- res.defs = defs;
- for (var key in proto) if (proto[has](key)) {
- res[key] = proto[key];
- }
- res.paper = res.root = res;
- } else {
- res = make("svg", glob.doc.body);
- $(res.node, {
- height: h,
- version: 1.1,
- width: w,
- xmlns: xmlns
- });
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement