Splitting fixes
[raphael] / raphael.svg.js
index 61cc78b..4fb1a62 100644 (file)
@@ -15,7 +15,9 @@ window.Raphael.svg && function (R) {
         math = Math,
         mmax = math.max,
         abs = math.abs,
+        pow = math.pow,
         separator = /[, ]+/,
+        eve = R.eve,
         E = "";
     // SVG
     var xlink = "http://www.w3.org/1999/xlink",
@@ -55,7 +57,7 @@ window.Raphael.svg && function (R) {
         oid = oid && oid.match(rgGrad);
         if (oid && !--gradients[oid[1]]) {
             delete gradients[oid[1]];
-            paper.defs.removeChild(g.doc.getElementById(oid[1]));
+            paper.defs.removeChild(R._g.doc.getElementById(oid[1]));
         }
     },
     addGradientFill = function (element, gradient) {
@@ -209,7 +211,7 @@ window.Raphael.svg && function (R) {
             if (type != "none") {
                 var pathId = "raphael-marker-" + type,
                     markerId = "raphael-marker-" + se + type + w + h;
-                if (!g.doc.getElementById(pathId)) {
+                if (!R._g.doc.getElementById(pathId)) {
                     p.defs.appendChild($($("path"), {
                         "stroke-linecap": "round",
                         d: markers[type],
@@ -219,7 +221,7 @@ window.Raphael.svg && function (R) {
                 } else {
                     markerCounter[pathId]++;
                 }
-                var marker = g.doc.getElementById(markerId),
+                var marker = R._g.doc.getElementById(markerId),
                     use;
                 if (!marker) {
                     marker = $($("marker"), {
@@ -278,7 +280,7 @@ window.Raphael.svg && function (R) {
                 delete o._.arrows[se + "String"];
             }
             for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) {
-                var item = g.doc.getElementById(attr);
+                var item = R._g.doc.getElementById(attr);
                 item && item.parentNode.removeChild(item);
             }
         }
@@ -301,7 +303,7 @@ window.Raphael.svg && function (R) {
             node = o.node,
             attrs = o.attrs,
             addDashes = function (o, value) {
-                value = dasharray[lowerCase.call(value)];
+                value = dasharray[Str(value).toLowerCase()];
                 if (value) {
                     var width = o.attrs["stroke-width"] || "1",
                         butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0,
@@ -328,7 +330,7 @@ window.Raphael.svg && function (R) {
                     case "title":
                     case "target":
                         var pn = node.parentNode;
-                        if (lowerCase.call(pn.tagName) != "a") {
+                        if (pn.tagName.toLowerCase() != "a") {
                             var hl = $("a");
                             pn.insertBefore(hl, node);
                             hl.appendChild(node);
@@ -371,7 +373,7 @@ window.Raphael.svg && function (R) {
                             o.clip = rc;
                         }
                         if (!value) {
-                            var clip = g.doc.getElementById(node.getAttribute("clip-path").replace(/(^url\(#|\)$)/g, E));
+                            var clip = R._g.doc.getElementById(node.getAttribute("clip-path").replace(/(^url\(#|\)$)/g, E));
                             clip && clip.parentNode.removeChild(clip);
                             $(node, {"clip-path": E});
                             delete o.clip;
@@ -501,7 +503,7 @@ window.Raphael.svg && function (R) {
                                 $(node, {"fill-opacity": attrs["fill-opacity"]});
                         } else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) {
                             if ("opacity" in attrs || "fill-opacity" in attrs) {
-                                var gradient = g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
+                                var gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
                                 if (gradient) {
                                     var stops = gradient.getElementsByTagName("stop");
                                     $(stops[stops.length - 1], {"stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1)});
@@ -531,7 +533,7 @@ window.Raphael.svg && function (R) {
                         // fall
                     case "fill-opacity":
                         if (attrs.gradient) {
-                            gradient = g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
+                            gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
                             if (gradient) {
                                 stops = gradient.getElementsByTagName("stop");
                                 $(stops[stops.length - 1], {"stop-opacity": value});