Extend native DOM methods in given window scope.
Wonder what happens now with SVG in Explorer?
778019
function() {
		var Elm = gui.Client.isExplorer ? HTMLElement : Element;
		this._change(Elm.prototype, gui.DOMCombos);
	}
218372
function(callback) {
      var el = fabric.document.createElement('canvas');
      if (!el.getContext && typeof G_vmlCanvasManager != 'undefined') {
        G_vmlCanvasManager.initElement(el);
      }

      el.width = this.getBoundingRectWidth();
      el.height = this.getBoundingRectHeight();

      fabric.util.wrapElement(el, 'div');

      var canvas = new fabric.Canvas(el);
      canvas.backgroundColor = 'transparent';
      canvas.renderAll();

      if (this.constructor.async) {
        this.clone(proceed);
      }
      else {
        proceed(this.clone());
      }

      function proceed(clone) {
        clone.left = el.width / 2;
        clone.top = el.height / 2;

        clone.setActive(false);

        canvas.add(clone);
        var data = canvas.toDataURL('png');

        canvas.dispose();
        canvas = clone = null;

        callback && callback(data);
      }
    }
317788
function(ev, newVal) {
                            scopePropertyUpdating = name;
                            componentScope.attr(name, newVal);
                            scopePropertyUpdating = null;
                        }
418517
function(el, hookupOptions) {
                    // Setup values passed to component
                    var initalScopeData = {},
                        component = this,
                        twoWayBindings = {},
                        // what scope property is currently updating
                        scopePropertyUpdating,
                        // the object added to the scope
                        componentScope,
                        frag;

                    // ## Scope

                    // Add scope prototype properties marked with an "@" to the `initialScopeData` object
                    can.each(this.constructor.attributeScopeMappings, function(val, prop) {
                        initalScopeData[prop] = el.getAttribute(can.hyphenate(val));
                    });

                    // Get the value in the scope for each attribute
                    // the hookup should probably happen after?
                    can.each(can.makeArray(el.attributes), function(node, index) {
                        var name = can.camelize(node.nodeName.toLowerCase()),
                            value = node.value;



                        // Ignore attributes already present in the ScopeMappings.
                        if (component.constructor.attributeScopeMappings[name] || ignoreAttributesRegExp.test(name) || viewCallbacks.attr(node.nodeName)) {
                            return;
                        }
                        // Only setup bindings if attribute looks like `foo="{bar}"`
                        if (value[0] === "{" && value[value.length - 1] === "}") {
                            value = value.substr(1, value.length - 2);
                        } else {
                            // Legacy template types will crossbind "foo=bar"
                            if (hookupOptions.templateType !== "legacy") {
                                initalScopeData[name] = value;
                                return;
                            }
                        }
                        // Cross-bind the value in the scope to this 
                        // component's scope
                        var computeData = hookupOptions.scope.computeData(value, {
                                args: []
                            }),
                            compute = computeData.compute;

                        // bind on this, check it's value, if it has dependencies
                        var handler = function(ev, newVal) {
                            scopePropertyUpdating = name;
                            componentScope.attr(name, newVal);
                            scopePropertyUpdating = null;
                        };

                        // Compute only returned if bindable
                        compute.bind("change", handler);

                        // Set the value to be added to the scope
                        initalScopeData[name] = compute();

                        // We don't need to listen to the compute `change` if it doesn't have any dependencies
                        if (!compute.hasDependencies) {
                            compute.unbind("change", handler);
                        } else {
                            // Make sure we unbind (there's faster ways of doing this)
                            can.bind.call(el, "removed", function() {
                                compute.unbind("change", handler);
                            });
                            // Setup the two-way binding
                            twoWayBindings[name] = computeData;
                        }

                    });
                    if (this.constructor.Map) {
                        // If `Map` property is set on the constructor use it to wrap the `initialScopeData`
                        componentScope = new this.constructor.Map(initalScopeData);
                    } else if (this.scope instanceof can.Map) {
                        // If `this.scope` is instance of `can.Map` assign it to the `componentScope`
                        componentScope = this.scope;
                    } else if (can.isFunction(this.scope)) {
                        // If `this.scope` is a function, call the function and 
                        var scopeResult = this.scope(initalScopeData, hookupOptions.scope, el);

                        if (scopeResult instanceof can.Map) {
                            // If the function returns a can.Map, use that as the scope
                            componentScope = scopeResult;
                        } else if (scopeResult.prototype instanceof can.Map) {
                            // If `scopeResult` is of a `can.Map` type, use it to wrap the `initialScopeData`
                            componentScope = new scopeResult(initalScopeData);
                        } else {
                            // Otherwise extend `can.Map` with the `scopeResult` and initialize it with the `initialScopeData`
                            componentScope = new(can.Map.extend(scopeResult))(initalScopeData);
                        }

                    }

                    // ## Two way bindings

                    // Object to hold the bind handlers so we can tear them down
                    var handlers = {};
                    // Setup reverse bindings
                    can.each(twoWayBindings, function(computeData, prop) {
                        handlers[prop] = function(ev, newVal) {
                            // Check that this property is not being changed because
                            // it's source value just changed
                            if (scopePropertyUpdating !== prop) {
                                computeData.compute(newVal);
                            }
                        };
                        componentScope.bind(prop, handlers[prop]);
                    });
                    // Teardown reverse bindings when the element is removed
                    can.bind.call(el, "removed", function() {
                        can.each(handlers, function(handler, prop) {
                            componentScope.unbind(prop, handlers[prop]);
                        });
                    });
                    // Setup the attributes bindings
                    if (!can.isEmptyObject(this.constructor.attributeScopeMappings) || hookupOptions.templateType !== "legacy") {
                        // Bind on the `attributes` event and update the scope.
                        can.bind.call(el, "attributes", function(ev) {
                            // Convert attribute name from the `attribute-name` to the `attributeName` format.
                            var camelized = can.camelize(ev.attributeName);
                            if (!twoWayBindings[camelized]) {
                                // If there is a mapping for this attribute, update the `componentScope` attribute
                                componentScope.attr(camelized, el.getAttribute(ev.attributeName));
                            }
                        });

                    }

                    // Set `componentScope` to `this.scope` and set it to the element's `data` object as a `scope` property
                    this.scope = componentScope;
                    can.data(can.$(el), "scope", this.scope);

                    // Create a real Scope object out of the scope property
                    var renderedScope = hookupOptions.scope.add(this.scope),
                        options = {
                            helpers: {}
                        };

                    // ## Helpers

                    // Setup helpers to callback with `this` as the component
                    can.each(this.helpers || {}, function(val, prop) {
                        if (can.isFunction(val)) {
                            options.helpers[prop] = function() {
                                return val.apply(componentScope, arguments);
                            };
                        }
                    });

                    // ## `events` control

                    // Create a control to listen to events
                    this._control = new this.constructor.Control(el, {
                            // Pass the scope to the control so we can listen to it's changes from the controller.
                            scope: this.scope
                        });

                    // ## Rendering

                    // If this component has a template (that we've already converted to a renderer)
                    if (this.constructor.renderer) {
                        // If `options.tags` doesn't exist set it to an empty object.
                        if (!options.tags) {
                            options.tags = {};
                        }

                        // We need be alerted to when a <content> element is rendered so we can put the original contents of the widget in its place
                        options.tags.content = function contentHookup(el, rendererOptions) {
                            // First check if there was content within the custom tag
                            // otherwise, render what was within <content>, the default code
                            var subtemplate = hookupOptions.subtemplate || rendererOptions.subtemplate;

                            if (subtemplate) {

                                // `rendererOptions.options` is a scope of helpers where `<content>` was found, so
                                // the right helpers should already be available.
                                // However, `_tags.content` is going to point to this current content callback.  We need to 
                                // remove that so it will walk up the chain

                                delete options.tags.content;

                                can.view.live.replace([el], subtemplate(
                                        // This is the context of where `<content>` was found
                                        // which will have the the component's context
                                        rendererOptions.scope,

                                        rendererOptions.options));

                                // Restore the content tag so it could potentially be used again (as in lists)
                                options.tags.content = contentHookup;
                            }
                        };
                        // Render the component's template
                        frag = this.constructor.renderer(renderedScope, hookupOptions.options.add(options));
                    } else {
                        // Otherwise render the contents between the 
                        if (hookupOptions.templateType === "legacy") {
                            frag = can.view.frag(hookupOptions.subtemplate ? hookupOptions.subtemplate(renderedScope, hookupOptions.options.add(options)) : "");
                        } else {
                            frag = hookupOptions.subtemplate ? hookupOptions.subtemplate(renderedScope, hookupOptions.options.add(options)) : document.createDocumentFragment();
                        }

                    }
                    // Append the resulting document fragment to the element
                    can.appendChild(el, frag);
                }
240676
function(scope, $element, attrs, ctrl, $transclude) {
      var previousElement, previousScope;
      scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) {
        if (previousElement) {
          $animate.leave(previousElement);
        }
        if (previousScope) {
          previousScope.$destroy();
          previousScope = null;
        }
        if (value || value === 0) {
          previousScope = scope.$new();
          $transclude(previousScope, function(element) {
            previousElement = element;
            $animate.enter(element, null, $element);
          });
        }
      });
    }
451786
function () {

            var nViewportOffset = Overlay.VIEWPORT_OFFSET,
                elementWidth = this.element.offsetWidth,
                elementHeight = this.element.offsetHeight,
                viewPortWidth = Dom.getViewportWidth(),
                viewPortHeight = Dom.getViewportHeight(),
                x,
                y;

            if (elementWidth < viewPortWidth) {
                x = (viewPortWidth / 2) - (elementWidth / 2) + Dom.getDocumentScrollLeft();
            } else {
                x = nViewportOffset + Dom.getDocumentScrollLeft();
            }

            if (elementHeight < viewPortHeight) {
                y = (viewPortHeight / 2) - (elementHeight / 2) + Dom.getDocumentScrollTop();
            } else {
                y = nViewportOffset + Dom.getDocumentScrollTop();
            }

            this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
            this.cfg.refireEvent("iframe");

            if (UA.webkit) {
                this.forceContainerRedraw();
            }
        }
1110449
function(element) {
                if (element === elt) {
                    var wrapper = svgCanvas.getElement();
                    wrapper.parentNode.removeChild(wrapper);
                }
            }
516931
function(src) {
  if (src.__src) return src;
  if (typeof src === 'string') src = { type: src };

  var event = { __src: src }
    , target;

  target = src.target || src.srcElement || document;
  event.target = target.nodeType !== 3 
               ? target 
               : target.parentNode;
  event.currentTarget = src.currentTarget || target;
  event.type = src.type;

  event.key = function() {
    // mozilla may use .which
    return src.which || src.keyCode
      || src.charCode || src.key
      || src.char || 0;
  };

  event.button = function() {
    // webkit uses .which
    var button = src.button != null
      ? +src.button
      : src.which != null
        ? src.which - 1
        : undefined;

    if (DOM.env.ie) {
      // IE needs fixing: 1 -> 0, 4 -> 1, 2 -> 2
      button = button === 1 
        ? 0 
        : button === 4 ? 1 : button;
    }

    return {
      left: button === 0,
      middle: button === 1,
      right: button === 2
    };
  };

  event.cursor = function(x, y) {
    if (typeof src.clientX === 'number') {
      var doc = DOM.getDocument(target)
        , root = doc.documentElement
        , body = doc.body;

      x = src.clientX
        + (doc.scrollLeft || root.scrollLeft || body.scrollLeft || 0)
        - (doc.clientLeft || root.clientLeft || body.clientLeft || 0);
      y = src.clientY
        + (doc.scrollTop || root.scrollTop || body.scrollTop || 0)
        - (doc.clientTop || root.clientTop || body.clientTop || 0);
    } else if (typeof src.pageX === 'number') {
      x = src.pageX;
      y = src.pageY;
    }
    return { x: x, y: y };
  };

  if (src.type === 'mouseover' 
      || src.type === 'mouseout') {
    if (!src.relatedTarget) {
      event.relatedTarget = src.type === 'mouseover'
                          ? src.fromTarget 
                          : src.toTarget;
    } else {
      event.relatedTarget = src.relatedTarget;
    }
  }

  //event.returnValue = src.returnValue;
  event.preventDefault = function() {
    if (src.preventDefault) {
      src.preventDefault();
    }
    src.returnValue = false;
  };
  event.stopPropagation = function() {
    if (src.stopPropagation) {
      src.stopPropagation();
    }
    src.cancelBubble = true;
  };
  event.stop = function() {
    event.stopPropagation();
    event.preventDefault();
  };
  event.kill = function() {
    event.stop();
    event.dead = true;
  };

  return event;
}
615093
function prepareAndStyle() {
    var viewBoxSize = this.config ? this.config.viewBoxSize : config.defaultViewBoxSize;
    angular.forEach({
      'fit': '',
      'height': '100%',
      'width': '100%',
      'preserveAspectRatio': 'xMidYMid meet',
      'viewBox': this.element.getAttribute('viewBox') || ('0 0 ' + viewBoxSize + ' ' + viewBoxSize),
      'focusable': false // Disable IE11s default behavior to make SVGs focusable
    }, function(val, attr) {
      this.element.setAttribute(attr, val);
    }, this);
  }
424238
function scrollIntoView (instance) {
  const rect = getInstanceOrVnodeRect(instance)
  if (rect) {
    // TODO: Handle this for non-browser environments.
    window.scrollBy(0, rect.top + (rect.height - window.innerHeight) / 2)
  }
}
676791
function () {
      this.removeChildInstances();

      if (this.template) {
        // temporarily assign a new node to get the content in a doc fragment
        this.vscope=this.parent.vscope; // to come back to original state, when the scope has not been changed by the template
        var targs=this.getTemplateArguments(), cargs=this.getCptArguments();
        var realNode = this.node;
        var df = doc.createDocumentFragment();
        this.node = df;
        this.template.call(this, targs, cargs); // WARNING: this changes vscope to the template vscope

        realNode.insertBefore(df, this.node2);
        this.replaceNodeBy(df , realNode); // recursively remove doc fragment reference
        // now this.node=realNode
        this.isDOMempty = false;
      }
  }
767598
function(elem) {

		try {
			// TODO: Fix issue with rotated groups. Currently they work
			// fine in FF, but not in other browsers (same problem mentioned
			// in Issue 339 comment #2).

			var bb = svgedit.utilities.getBBox(elem);
			var angle = svgedit.utilities.getRotationAngle(elem);

			if ((angle && angle % 90) ||
				svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(elem))) {
				// Accurate way to get BBox of rotated element in Firefox:
				// Put element in group and get its BBox
				var good_bb = false;
				// Get the BBox from the raw path for these elements
				var elemNames = ['ellipse', 'path', 'line', 'polyline', 'polygon'];
				if (elemNames.indexOf(elem.tagName) >= 0) {
					bb = good_bb = canvas.convertToPath(elem, true);
				} else if (elem.tagName == 'rect') {
					// Look for radius
					var rx = elem.getAttribute('rx');
					var ry = elem.getAttribute('ry');
					if (rx || ry) {
						bb = good_bb = canvas.convertToPath(elem, true);
					}
				}

				if (!good_bb) {
					// Must use clone else FF freaks out
					var clone = elem.cloneNode(true);
					var g = document.createElementNS(NS.SVG, "g");
					var parent = elem.parentNode;
					parent.appendChild(g);
					g.appendChild(clone);
					bb = svgedit.utilities.bboxToObj(g.getBBox());
					parent.removeChild(g);
				}

				// Old method: Works by giving the rotated BBox,
				// this is (unfortunately) what Opera and Safari do
				// natively when getting the BBox of the parent group
//						var angle = angle * Math.PI / 180.0;
//						var rminx = Number.MAX_VALUE, rminy = Number.MAX_VALUE, 
//							rmaxx = Number.MIN_VALUE, rmaxy = Number.MIN_VALUE;
//						var cx = round(bb.x + bb.width/2),
//							cy = round(bb.y + bb.height/2);
//						var pts = [ [bb.x - cx, bb.y - cy], 
//									[bb.x + bb.width - cx, bb.y - cy],
//									[bb.x + bb.width - cx, bb.y + bb.height - cy],
//									[bb.x - cx, bb.y + bb.height - cy] ];
//						var j = 4;
//						while (j--) {
//							var x = pts[j][0],
//								y = pts[j][1],
//								r = Math.sqrt( x*x + y*y );
//							var theta = Math.atan2(y,x) + angle;
//							x = round(r * Math.cos(theta) + cx);
//							y = round(r * Math.sin(theta) + cy);
//		
//							// now set the bbox for the shape after it's been rotated
//							if (x < rminx) rminx = x;
//							if (y < rminy) rminy = y;
//							if (x > rmaxx) rmaxx = x;
//							if (y > rmaxy) rmaxy = y;
//						}
//						
//						bb.x = rminx;
//						bb.y = rminy;
//						bb.width = rmaxx - rminx;
//						bb.height = rmaxy - rminy;
			}
			return bb;
		} catch(e) {
			console.log(elem, e);
			return null;
		}
	}
757494
function(view, element) {
          var methods = {
            hasModifier: function(needle) {
              var tokens = ModifierUtil.split(element.attr('modifier'));
              needle = typeof needle === 'string' ? needle.trim() : '';

              return ModifierUtil.split(needle).some(function(needle) {
                return tokens.indexOf(needle) != -1;
              });
            },

            removeModifier: function(needle) {
              needle = typeof needle === 'string' ? needle.trim() : '';

              var modifier = ModifierUtil.split(element.attr('modifier')).filter(function(token) {
                return token !== needle;
              }).join(' ');

              element.attr('modifier', modifier);
            },

            addModifier: function(modifier) {
              element.attr('modifier', element.attr('modifier') + ' ' + modifier);
            },

            setModifier: function(modifier) {
              element.attr('modifier', modifier);
            },

            toggleModifier: function(modifier) {
              if (this.hasModifier(modifier)) {
                this.removeModifier(modifier);
              } else {
                this.addModifier(modifier);
              }
            }
          };

          for (var method in methods) {
            if (methods.hasOwnProperty(method)) {
              view[method] = methods[method];
            }
          }
        }
1368085
function (additionalOptions) {
		var chart = this,
			chartCopy,
			sandbox,
			svg,
			seriesOptions,
			sourceWidth,
			sourceHeight,
			cssWidth,
			cssHeight,
			options = merge(chart.options, additionalOptions); // copy the options and add extra options

		// IE compatibility hack for generating SVG content that it doesn't really understand
		if (!doc.createElementNS) {
			/*jslint unparam: true*//* allow unused parameter ns in function below */
			doc.createElementNS = function (ns, tagName) {
				return doc.createElement(tagName);
			};
			/*jslint unparam: false*/
		}

		// create a sandbox where a new chart will be generated
		sandbox = createElement(DIV, null, {
			position: ABSOLUTE,
			top: '-9999em',
			width: chart.chartWidth + PX,
			height: chart.chartHeight + PX
		}, doc.body);

		// get the source size
		cssWidth = chart.renderTo.style.width;
		cssHeight = chart.renderTo.style.height;
		sourceWidth = options.exporting.sourceWidth ||
			options.chart.width ||
			(/px$/.test(cssWidth) && parseInt(cssWidth, 10)) ||
			600;
		sourceHeight = options.exporting.sourceHeight ||
			options.chart.height ||
			(/px$/.test(cssHeight) && parseInt(cssHeight, 10)) ||
			400;

		// override some options
		extend(options.chart, {
			animation: false,
			renderTo: sandbox,
			forExport: true,
			width: sourceWidth,
			height: sourceHeight
		});
		options.exporting.enabled = false; // hide buttons in print
		delete options.data; // #3004

		// prepare for replicating the chart
		options.series = [];
		each(chart.series, function (serie) {
			seriesOptions = merge(serie.options, {
				animation: false, // turn off animation
				enableMouseTracking: false,
				showCheckbox: false,
				visible: serie.visible
			});

			if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set
				options.series.push(seriesOptions);
			}
		});

		// Axis options must be merged in one by one, since it may be an array or an object (#2022, #3900)
		if (additionalOptions) {
			each(['xAxis', 'yAxis'], function (axisType) {
				each(splat(additionalOptions[axisType]), function (axisOptions, i) {
					options[axisType][i] = merge(options[axisType][i], axisOptions);
				});
			});
		}

		// generate the chart copy
		chartCopy = new Highcharts.Chart(options, chart.callback);

		// reflect axis extremes in the export
		each(['xAxis', 'yAxis'], function (axisType) {
			each(chart[axisType], function (axis, i) {
				var axisCopy = chartCopy[axisType][i],
					extremes = axis.getExtremes(),
					userMin = extremes.userMin,
					userMax = extremes.userMax;

				if (axisCopy && (userMin !== UNDEFINED || userMax !== UNDEFINED)) {
					axisCopy.setExtremes(userMin, userMax, true, false);
				}
			});
		});

		// get the SVG from the container's innerHTML
		svg = chartCopy.container.innerHTML;

		// free up memory
		options = null;
		chartCopy.destroy();
		discardElement(sandbox);

		// sanitize
		svg = this.sanitizeSVG(svg);

		// IE9 beta bugs with innerHTML. Test again with final IE9.
		svg = svg.replace(/(url\(#highcharts-[0-9]+)&quot;/g, '$1')
			.replace(/&quot;/g, "'");

		return svg;
	}
152906
function Icon(el, config) {
    // If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>.
    if (el && el.tagName.toLowerCase() === 'symbol') {
      var viewbox = el.getAttribute('viewBox');
      // // Check if innerHTML is supported as IE11 does not support innerHTML on SVG elements.
      if (el.innerHTML) {
        el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">')
          .html(el.innerHTML)[0];
      } else {
        el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">')
          .append($mdUtil.getInnerHTML(el))[0];
      }
      if (viewbox) el.setAttribute('viewBox', viewbox);
    }

    if (el && el.tagName.toLowerCase() !== 'svg') {
      el = angular.element(
        '<svg xmlns="http://www.w3.org/2000/svg">').append(el.cloneNode(true))[0];
    }

    // Inject the namespace if not available...
    if (!el.getAttribute('xmlns')) {
      el.setAttribute('xmlns', "http://www.w3.org/2000/svg");
    }

    this.element = el;
    this.config = config;
    this.prepare();
  }
1215453
function(el, tagName, tagData) {
                var helperTagCallback = tagData.options.read('tags.' + tagName, {
                        isArgument: true,
                        proxyMethods: false
                    })
                    .value,
                    tagCallback = helperTagCallback || tags[tagName];

                // If this was an element like <foo-bar> that doesn't have a component, just render its content
                var scope = tagData.scope,
                    res;

                if (tagCallback) {
                    var reads = can.__clearReading();
                    res = tagCallback(el, tagData);
                    can.__setReading(reads);
                } else {
                    res = scope;
                }



                // If the tagCallback gave us something to render with, and there is content within that element
                // render it!
                if (res && tagData.subtemplate) {

                    if (scope !== res) {
                        scope = scope.add(res);
                    }
                    var result = tagData.subtemplate(scope, tagData.options);
                    var frag = typeof result === "string" ? can.view.frag(result) : result;
                    can.appendChild(el, frag);
                }
            }
286924
function handleMouseOver(el, d, chartWidth, chartHeight) {
            drawLegend(d);
            dispatcher.call('customMouseOver', el, d, d3Selection.mouse(el), [chartWidth, chartHeight]);

            if (hasHoverAnimation) {
                // if the hovered slice is not the same as the last slice hovered
                // after mouseout event, then shrink the last slice that was highlighted
                if (lastHighlightedSlice && el !== lastHighlightedSlice) {
                    tweenGrowth(lastHighlightedSlice, externalRadius - radiusHoverOffset, pieHoverTransitionDuration);
                }
                if (highlightedSlice && el !== highlightedSlice) {
                    tweenGrowth(highlightedSlice, externalRadius - radiusHoverOffset);
                }
                tweenGrowth(el, externalRadius);
            }

        }