1 // ┌─────────────────────────────────────────────────────────────────────┐ \\
2 // │ Raphaël 2 - JavaScript Vector Library │ \\
3 // ├─────────────────────────────────────────────────────────────────────┤ \\
5 // ├─────────────────────────────────────────────────────────────────────┤ \\
6 // │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
7 // │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
8 // │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
9 // └─────────────────────────────────────────────────────────────────────┘ \\
10 window.Raphael.vml && function (R) {
11 var has = "hasOwnProperty",
22 ms = " progid:DXImageTransform.Microsoft",
25 map = {M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x"},
26 bites = /([clmz]),?([^clmz]*)/gi,
27 blurregexp = / progid:\S+Blur\([^\)]+\)/g,
29 cssDot = "position:absolute;left:0;top:0;width:1px;height:1px",
31 pathTypes = {path: 1, rect: 1, image: 1},
32 ovalTypes = {circle: 1, ellipse: 1},
33 path2vml = function (path) {
34 var total = /[ahqstv]/ig,
35 command = R._pathToAbsolute;
36 Str(path).match(total) && (command = R._path2curve);
38 if (command == R._pathToAbsolute && !Str(path).match(total)) {
39 var res = Str(path).replace(bites, function (all, command, args) {
41 isMove = command.toLowerCase() == "m",
43 args.replace(val, function (value) {
44 if (isMove && vals.length == 2) {
45 res += vals + map[command == "m" ? "l" : "L"];
48 vals.push(round(value * zoom));
54 var pa = command(path), p, r;
56 for (var i = 0, ii = pa.length; i < ii; i++) {
58 r = pa[i][0].toLowerCase();
59 r == "z" && (r = "x");
60 for (var j = 1, jj = p.length; j < jj; j++) {
61 r += round(p[j] * zoom) + (j != jj - 1 ? "," : E);
67 compensation = function (deg, dx, dy) {
69 m.rotate(-deg, .5, .5);
75 setCoords = function (p, sx, sy, dx, dy, deg) {
86 s.visibility = "hidden";
90 o.coordsize = abs(kx) + S + abs(ky);
91 s.rotation = deg * (sx * sy < 0 ? -1 : 1);
93 var c = compensation(deg, dx, dy);
97 sx < 0 && (flip += "x");
98 sy < 0 && (flip += " y") && (y = -1);
100 o.coordorigin = (dx * -kx) + S + (dy * -ky);
101 if (fillpos || _.fillsize) {
102 var fill = o.getElementsByTagName(fillString);
103 fill = fill && fill[0];
106 c = compensation(deg, m.x(fillpos[0], fillpos[1]), m.y(fillpos[0], fillpos[1]));
107 fill.position = c.dx * y + S + c.dy * y;
110 fill.size = _.fillsize[0] * abs(sx) + S + _.fillsize[1] * abs(sy);
114 s.visibility = "visible";
116 R.toString = function () {
117 return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version;
119 addArrow = function (o, value, isEnd) {
120 var values = Str(value).toLowerCase().split("-"),
121 se = isEnd ? "end" : "start",
137 case "narrow": h = values[i]; break;
139 case "short": w = values[i]; break;
142 var stroke = o.node.getElementsByTagName("stroke")[0];
143 stroke[se + "arrow"] = type;
144 stroke[se + "arrowlength"] = w;
145 stroke[se + "arrowwidth"] = h;
147 setFillAndStroke = function (o, params) {
148 // o.paper.canvas.style.display = "none";
149 o.attrs = o.attrs || {};
154 newpath = pathTypes[o.type] && (params.x != a.x || params.y != a.y || params.width != a.width || params.height != a.height || params.cx != a.cx || params.cy != a.cy || params.rx != a.rx || params.ry != a.ry || params.r != a.r),
155 isOval = ovalTypes[o.type] && (a.cx != params.cx || a.cy != params.cy || a.r != params.r || a.rx != params.rx || a.ry != params.ry),
159 for (var par in params) if (params[has](par)) {
160 a[par] = params[par];
163 a.path = R._getPath[o.type](o);
166 params.href && (node.href = params.href);
167 params.title && (node.title = params.title);
168 params.target && (node.target = params.target);
169 params.cursor && (s.cursor = params.cursor);
170 "blur" in params && o.blur(params.blur);
171 if (params.path && o.type == "path" || newpath) {
172 node.path = path2vml(~Str(a.path).toLowerCase().indexOf("r") ? R._pathToAbsolute(a.path) : a.path);
173 if (o.type == "image") {
174 o._.fillpos = [a.x, a.y];
175 o._.fillsize = [a.width, a.height];
176 setCoords(o, 1, 1, 0, 0, 0);
179 "transform" in params && o.transform(params.transform);
183 rx = +a.rx || +a.r || 0,
184 ry = +a.ry || +a.r || 0;
185 node.path = R.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x", round((cx - rx) * zoom), round((cy - ry) * zoom), round((cx + rx) * zoom), round((cy + ry) * zoom), round(cx * zoom));
187 if ("clip-rect" in params) {
188 var rect = Str(params["clip-rect"]).split(separator);
189 if (rect.length == 4) {
190 rect[2] = +rect[2] + (+rect[0]);
191 rect[3] = +rect[3] + (+rect[1]);
192 var div = node.clipRect || R._g.doc.createElement("div"),
194 dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect);
195 if (!node.clipRect) {
196 dstyle.position = "absolute";
199 dstyle.width = o.paper.width + "px";
200 dstyle.height = o.paper.height + "px";
201 node.parentNode.insertBefore(div, node);
202 div.appendChild(node);
206 if (!params["clip-rect"]) {
207 node.clipRect && (node.clipRect.style.clip = E);
211 var textpathStyle = o.textpath.style;
212 params.font && (textpathStyle.font = params.font);
213 params["font-family"] && (textpathStyle.fontFamily = '"' + params["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g, E) + '"');
214 params["font-size"] && (textpathStyle.fontSize = params["font-size"]);
215 params["font-weight"] && (textpathStyle.fontWeight = params["font-weight"]);
216 params["font-style"] && (textpathStyle.fontStyle = params["font-style"]);
218 if ("arrow-start" in params) {
219 addArrow(res, params["arrow-start"]);
221 if ("arrow-end" in params) {
222 addArrow(res, params["arrow-end"], 1);
224 if (params.opacity != null ||
225 params["stroke-width"] != null ||
226 params.fill != null ||
227 params.src != null ||
228 params.stroke != null ||
229 params["stroke-width"] != null ||
230 params["stroke-opacity"] != null ||
231 params["fill-opacity"] != null ||
232 params["stroke-dasharray"] != null ||
233 params["stroke-miterlimit"] != null ||
234 params["stroke-linejoin"] != null ||
235 params["stroke-linecap"] != null) {
236 var fill = node.getElementsByTagName(fillString),
238 fill = fill && fill[0];
239 !fill && (newfill = fill = createNode(fillString));
240 if (o.type == "image" && params.src) {
241 fill.src = params.src;
243 params.fill && (fill.on = true);
244 if (fill.on == null || params.fill == "none" || params.fill === null) {
247 if (fill.on && params.fill) {
248 var isURL = Str(params.fill).match(R._ISURL);
250 fill.parentNode == node && node.removeChild(fill);
254 var bbox = o.getBBox(1);
255 fill.position = bbox.x + S + bbox.y;
256 o._.fillpos = [bbox.x, bbox.y];
258 R._preload(isURL[1], function () {
259 o._.fillsize = [this.offsetWidth, this.offsetHeight];
262 fill.color = R.getRGB(params.fill).hex;
265 if (R.getRGB(params.fill).error && (res.type in {circle: 1, ellipse: 1} || Str(params.fill).charAt() != "r") && addGradientFill(res, params.fill, fill)) {
267 a.gradient = params.fill;
272 if ("fill-opacity" in params || "opacity" in params) {
273 var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1);
274 opacity = mmin(mmax(opacity, 0), 1);
275 fill.opacity = opacity;
280 node.appendChild(fill);
281 var stroke = (node.getElementsByTagName("stroke") && node.getElementsByTagName("stroke")[0]),
283 !stroke && (newstroke = stroke = createNode("stroke"));
284 if ((params.stroke && params.stroke != "none") ||
285 params["stroke-width"] ||
286 params["stroke-opacity"] != null ||
287 params["stroke-dasharray"] ||
288 params["stroke-miterlimit"] ||
289 params["stroke-linejoin"] ||
290 params["stroke-linecap"]) {
293 (params.stroke == "none" || params.stroke === null || stroke.on == null || params.stroke == 0 || params["stroke-width"] == 0) && (stroke.on = false);
294 var strokeColor = R.getRGB(params.stroke);
295 stroke.on && params.stroke && (stroke.color = strokeColor.hex);
296 opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1);
297 var width = (toFloat(params["stroke-width"]) || 1) * .75;
298 opacity = mmin(mmax(opacity, 0), 1);
299 params["stroke-width"] == null && (width = a["stroke-width"]);
300 params["stroke-width"] && (stroke.weight = width);
301 width && width < 1 && (opacity *= width) && (stroke.weight = 1);
302 stroke.opacity = opacity;
304 params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter");
305 stroke.miterlimit = params["stroke-miterlimit"] || 8;
306 params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round");
307 if (params["stroke-dasharray"]) {
311 "-.": "shortdashdot",
312 "-..": "shortdashdotdot",
317 "--.": "longdashdot",
318 "--..": "longdashdotdot"
320 stroke.dashstyle = dasharray[has](params["stroke-dasharray"]) ? dasharray[params["stroke-dasharray"]] : E;
322 newstroke && node.appendChild(stroke);
324 if (res.type == "text") {
325 res.paper.canvas.style.display = E;
326 var span = res.paper.span,
328 fontSize = a.font && a.font.match(/\d+(?:\.\d*)?(?=px)/);
330 a.font && (s.font = a.font);
331 a["font-family"] && (s.fontFamily = a["font-family"]);
332 a["font-weight"] && (s.fontWeight = a["font-weight"]);
333 a["font-style"] && (s.fontStyle = a["font-style"]);
334 fontSize = toFloat(fontSize ? fontSize[0] : a["font-size"]);
335 s.fontSize = fontSize * m + "px";
336 res.textpath.string && (span.innerHTML = Str(res.textpath.string).replace(/</g, "<").replace(/&/g, "&").replace(/\n/g, "<br>"));
337 var brect = span.getBoundingClientRect();
338 res.W = a.w = (brect.right - brect.left) / m;
339 res.H = a.h = (brect.bottom - brect.top) / m;
340 // res.paper.canvas.style.display = "none";
342 res.Y = a.y + res.H / 2;
344 ("x" in params || "y" in params) && (res.path.v = R.format("m{0},{1}l{2},{1}", round(a.x * zoom), round(a.y * zoom), round(a.x * zoom) + 1));
345 var dirtyattrs = ["x", "y", "text", "font", "font-family", "font-weight", "font-style", "font-size"];
346 for (var d = 0, dd = dirtyattrs.length; d < dd; d++) if (dirtyattrs[d] in params) {
351 // text-anchor emulation
352 switch (a["text-anchor"]) {
354 res.textpath.style["v-text-align"] = "left";
358 res.textpath.style["v-text-align"] = "right";
359 res.bbx = -res.W / 2;
362 res.textpath.style["v-text-align"] = "center";
366 res.textpath.style["v-text-kern"] = true;
368 // res.paper.canvas.style.display = E;
370 addGradientFill = function (o, gradient, fill) {
371 o.attrs = o.attrs || {};
377 o.attrs.gradient = gradient;
378 gradient = Str(gradient).replace(R._radial_gradient, function (all, fx, fy) {
383 pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * ((fy > .5) * 2 - 1) + .5);
388 gradient = gradient.split(/\s*\-\s*/);
389 if (type == "linear") {
390 var angle = gradient.shift();
391 angle = -toFloat(angle);
396 var dots = R._parseDots(gradient);
400 o = o.shape || o.node;
404 fill.method = "none";
405 fill.color = dots[0].color;
406 fill.color2 = dots[dots.length - 1].color;
408 for (var i = 0, ii = dots.length; i < ii; i++) {
409 dots[i].offset && clrs.push(dots[i].offset + S + dots[i].color);
411 fill.colors = clrs.length ? clrs.join() : "0% " + fill.color;
412 if (type == "radial") {
413 fill.type = "gradientTitle";
415 fill.focussize = "0 0";
416 fill.focusposition = fxfy;
419 // fill.rotate= true;
420 fill.type = "gradient";
421 fill.angle = (270 - angle) % 360;
427 Element = function (node, vml) {
428 this[0] = this.node = node;
431 node.raphaelid = this.id;
436 this.matrix = R.matrix();
447 !vml.bottom && (vml.bottom = this);
449 vml.top && (vml.top.next = this);
455 Element.prototype = elproto;
456 elproto.constructor = Element;
457 elproto.transform = function (tstr) {
459 return this._.transform;
461 var vbs = this.paper._viewBoxShift,
462 vbt = vbs ? "s" + [vbs.scale, vbs.scale] + "-1-1t" + [vbs.dx, vbs.dy] : E,
465 oldt = tstr = Str(tstr).replace(/\.{3}|\u2026/g, this._.transform || E);
467 R._extractTransform(this, vbt + tstr);
468 var matrix = this.matrix.clone(),
472 isGrad = ~Str(this.attrs.fill).indexOf("-"),
473 isPatt = !Str(this.attrs.fill).indexOf("url(");
474 matrix.translate(-.5, -.5);
475 if (isPatt || isGrad || this.type == "image") {
476 skew.matrix = "1 0 0 1";
478 split = matrix.split();
479 if ((isGrad && split.noRotation) || !split.isSimple) {
480 o.style.filter = matrix.toFilter();
481 var bb = this.getBBox(),
482 bbt = this.getBBox(1),
485 o.coordorigin = (dx * -zoom) + S + (dy * -zoom);
486 setCoords(this, 1, 1, dx, dy, 0);
489 setCoords(this, split.scalex, split.scaley, split.dx, split.dy, split.rotate);
493 skew.matrix = Str(matrix);
494 skew.offset = matrix.offset();
496 oldt && (this._.transform = oldt);
499 elproto.rotate = function (deg, cx, cy) {
506 deg = Str(deg).split(separator);
507 if (deg.length - 1) {
508 cx = toFloat(deg[1]);
509 cy = toFloat(deg[2]);
511 deg = toFloat(deg[0]);
512 (cy == null) && (cx = cy);
513 if (cx == null || cy == null) {
514 var bbox = this.getBBox(1);
515 cx = bbox.x + bbox.width / 2;
516 cy = bbox.y + bbox.height / 2;
519 this.transform(this._.transform.concat([["r", deg, cx, cy]]));
522 elproto.translate = function (dx, dy) {
526 dx = Str(dx).split(separator);
530 dx = toFloat(dx[0]) || 0;
536 this.transform(this._.transform.concat([["t", dx, dy]]));
539 elproto.scale = function (sx, sy, cx, cy) {
543 sx = Str(sx).split(separator);
548 isNaN(cx) && (cx = null);
549 isNaN(cy) && (cy = null);
552 (sy == null) && (sy = sx);
553 (cy == null) && (cx = cy);
554 if (cx == null || cy == null) {
555 var bbox = this.getBBox(1);
557 cx = cx == null ? bbox.x + bbox.width / 2 : cx;
558 cy = cy == null ? bbox.y + bbox.height / 2 : cy;
560 this.transform(this._.transform.concat([["s", sx, sy, cx, cy]]));
564 elproto.hide = function () {
565 !this.removed && (this.node.style.display = "none");
568 elproto.show = function () {
569 !this.removed && (this.node.style.display = E);
572 elproto._getBBox = function () {
576 if (this.type == "text") {
578 x: this.X + (this.bbx || 0) - this.W / 2,
584 return pathDimensions(this.attrs.path);
587 elproto.remove = function () {
591 this.paper.__set__ && this.paper.__set__.exclude(this);
592 R.eve.unbind("*.*." + this.id);
593 R._tear(this, this.paper);
594 this.node.parentNode.removeChild(this.node);
595 this.shape && this.shape.parentNode.removeChild(this.shape);
596 for (var i in this) {
601 elproto.attr = function (name, value) {
607 for (var a in this.attrs) if (this.attrs[has](a)) {
608 res[a] = this.attrs[a];
610 res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient;
611 res.transform = this._.transform;
614 if (value == null && R.is(name, "string")) {
615 if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) {
616 return this.attrs.gradient;
618 var names = name.split(separator),
620 for (var i = 0, ii = names.length; i < ii; i++) {
622 if (name in this.attrs) {
623 out[name] = this.attrs[name];
624 } else if (R.is(this.paper.customAttributes[name], "function")) {
625 out[name] = this.paper.customAttributes[name].def;
627 out[name] = R._availableAttrs[name];
630 return ii - 1 ? out : out[names[0]];
632 if (this.attrs && value == null && R.is(name, "array")) {
634 for (i = 0, ii = name.length; i < ii; i++) {
635 out[name[i]] = this.attr(name[i]);
642 params[name] = value;
644 value == null && R.is(name, "object") && (params = name);
645 for (var key in params) {
646 R.eve("attr." + key + "." + this.id, this, params[key]);
649 for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) {
650 var par = this.paper.customAttributes[key].apply(this, [][concat](params[key]));
651 this.attrs[key] = params[key];
652 for (var subkey in par) if (par[has](subkey)) {
653 params[subkey] = par[subkey];
656 // this.paper.canvas.style.display = "none";
657 if (params.text && this.type == "text") {
658 this.textpath.string = params.text;
660 setFillAndStroke(this, params);
661 // this.paper.canvas.style.display = E;
665 elproto.toFront = function () {
666 !this.removed && this.node.parentNode.appendChild(this.node);
667 this.paper && this.paper.top != this && R._tofront(this, this.paper);
670 elproto.toBack = function () {
674 if (this.node.parentNode.firstChild != this.node) {
675 this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild);
676 R._toback(this, this.paper);
680 elproto.insertAfter = function (element) {
684 if (element.constructor == R.st.constructor) {
685 element = element[element.length - 1];
687 if (element.node.nextSibling) {
688 element.node.parentNode.insertBefore(this.node, element.node.nextSibling);
690 element.node.parentNode.appendChild(this.node);
692 R._insertafter(this, element, this.paper);
695 elproto.insertBefore = function (element) {
699 if (element.constructor == R.st.constructor) {
700 element = element[0];
702 element.node.parentNode.insertBefore(this.node, element.node);
703 R._insertbefore(this, element, this.paper);
706 elproto.blur = function (size) {
707 var s = this.node.runtimeStyle,
709 f = f.replace(blurregexp, E);
711 this.attrs.blur = size;
712 s.filter = f + S + ms + ".Blur(pixelradius=" + (+size || 1.5) + ")";
713 s.margin = R.format("-{0}px 0 0 -{0}px", round(+size || 1.5));
717 delete this.attrs.blur;
721 R._engine.path = function (pathString, vml) {
722 var el = createNode("shape");
723 el.style.cssText = cssDot;
724 el.coordsize = zoom + S + zoom;
725 el.coordorigin = vml.coordorigin;
726 var p = new Element(el, vml),
727 attr = {fill: "none", stroke: "#000"};
728 pathString && (attr.path = pathString);
732 setFillAndStroke(p, attr);
733 vml.canvas.appendChild(el);
734 var skew = createNode("skew");
736 el.appendChild(skew);
741 R._engine.rect = function (vml, x, y, w, h, r) {
742 var path = R._rectPath(x, y, w, h, r),
743 res = vml.path(path),
748 res.H = a.height = h;
754 R._engine.ellipse = function (vml, x, y, rx, ry) {
755 var res = vml.path(),
761 res.type = "ellipse";
762 setFillAndStroke(res, {
770 R._engine.circle = function (vml, x, y, r) {
771 var res = vml.path(),
775 res.W = res.H = r * 2;
777 setFillAndStroke(res, {
784 R._engine.image = function (vml, src, x, y, w, h) {
785 var path = R._rectPath(x, y, w, h),
786 res = vml.path(path).attr({stroke: "none"}),
789 fill = node.getElementsByTagName(fillString)[0];
794 res.H = a.height = h;
797 fill.parentNode == node && node.removeChild(fill);
801 res._.fillpos = [x, y];
802 res._.fillsize = [w, h];
803 node.appendChild(fill);
804 setCoords(res, 1, 1, 0, 0, 0);
807 R._engine.text = function (vml, x, y, text) {
808 var el = createNode("shape"),
809 path = createNode("path"),
810 o = createNode("textpath");
814 path.v = R.format("m{0},{1}l{2},{1}", round(x * zoom), round(y * zoom), round(x * zoom) + 1);
815 path.textpathok = true;
816 o.string = Str(text);
818 el.style.cssText = cssDot;
819 el.coordsize = zoom + S + zoom;
820 el.coordorigin = "0 0";
821 var p = new Element(el, vml),
825 font: R._availableAttrs.font,
832 p.attrs.text = Str(text);
837 setFillAndStroke(p, attr);
839 el.appendChild(path);
840 vml.canvas.appendChild(el);
841 var skew = createNode("skew");
843 el.appendChild(skew);
848 R._engine.setSize = function (width, height) {
849 var cs = this.canvas.style;
851 this.height = height;
852 width == +width && (width += "px");
853 height == +height && (height += "px");
856 cs.clip = "rect(0 " + width + " " + height + " 0)";
858 setViewBox.apply(this, this._viewBox);
862 R._engine.setViewBox = function (x, y, w, h, fit) {
863 R.eve("setViewBox", this, this._viewBox, [x, y, w, h, fit]);
864 var width = this.width,
865 height = this.height,
866 size = 1 / mmax(w / width, h / height),
872 x -= (width - w * H) / 2 / H;
874 if (h * W < height) {
875 y -= (height - h * W) / 2 / W;
878 this._viewBox = [x, y, w, h, !!fit];
879 this._viewBoxShift = {
884 this.forEach(function (el) {
890 initWin = function (win) {
891 var doc = win.document;
892 doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
894 !doc.namespaces.rvml && doc.namespaces.add("rvml", "urn:schemas-microsoft-com:vml");
895 createNode = function (tagName) {
896 return doc.createElement('<rvml:' + tagName + ' class="rvml">');
899 createNode = function (tagName) {
900 return doc.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
905 R._engine.create = function () {
906 var con = R._getContainer.apply(0, arguments),
907 container = con.container,
914 throw new Error("VML container not found.");
916 var res = new R._Paper,
917 c = res.canvas = R._g.doc.createElement("div"),
921 width = width || 512;
922 height = height || 342;
925 width == +width && (width += "px");
926 height == +height && (height += "px");
927 res.coordsize = zoom * 1e3 + S + zoom * 1e3;
928 res.coordorigin = "0 0";
929 res.span = R._g.doc.createElement("span");
930 res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;";
931 c.appendChild(res.span);
932 cs.cssText = R.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", width, height);
933 if (container == 1) {
934 R._g.doc.body.appendChild(c);
937 cs.position = "absolute";
939 if (container.firstChild) {
940 container.insertBefore(c, container.firstChild);
942 container.appendChild(c);
945 // plugins.call(res, res, R.fn);
946 res.renderfix = function () {};
949 R.prototype.clear = function () {
950 R.eve("clear", this);
951 this.canvas.innerHTML = E;
952 this.span = R._g.doc.createElement("span");
953 this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
954 this.canvas.appendChild(this.span);
955 this.bottom = this.top = null;
957 R.prototype.remove = function () {
958 R.eve("remove", this);
959 this.canvas.parentNode.removeChild(this.canvas);
960 for (var i in this) {
961 this[i] = removed(i);
967 for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) {
968 setproto[method] = (function (methodname) {
971 return this.forEach(function (el) {
972 el[methodname].apply(el, arg);