MCPcopy Create free account
hub / github.com/codrops/RainEffect / _createSVG

Function _createSVG

demo/js/index.js:7540–7549  ·  view source on GitHub ↗
(type, container, attributes)

Source from the content-addressed store, hash-verified

7538 //Some browsers (like Firefox and IE) don't honor transform-origin properly in SVG elements, so we need to manually adjust the matrix accordingly. We feature detect here rather than always doing the conversion for certain browsers because they may fix the problem at some point in the future.
7539
7540 _createSVG = function(type, container, attributes) {
7541 var element = _doc.createElementNS("http://www.w3.org/2000/svg", type),
7542 reg = /([a-z])([A-Z])/g,
7543 p;
7544 for (p in attributes) {
7545 element.setAttributeNS(null, p.replace(reg, "$1-$2").toLowerCase(), attributes[p]);
7546 }
7547 container.appendChild(element);
7548 return element;
7549 },
7550 _docElement = _doc.documentElement,
7551 _forceSVGTransformAttr = (function() {
7552 //IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute. We populate this variable in the _parseTransform() method, and only if/when we come across an SVG element

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected