1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- (function() {'use strict';
-
-
-
-
-
-
-
- var proxied = jQuery.fn.attr,
-
- svgns = "http://www.w3.org/2000/svg";
- jQuery.fn.attr = function(key, value) {
- var i, attr;
- var len = this.length;
- if (!len) {return proxied.apply(this, arguments);}
- for (i = 0; i < len; ++i) {
- var elem = this[i];
-
- if (elem.namespaceURI === svgns) {
-
- if (value !== undefined) {
- elem.setAttribute(key, value);
- } else if ($.isArray(key)) {
-
- var j = key.length, obj = {};
- while (j--) {
- var aname = key[j];
- attr = elem.getAttribute(aname);
-
- if (attr || attr === "0") {
- attr = isNaN(attr) ? attr : (attr - 0);
- }
- obj[aname] = attr;
- }
- return obj;
- }
- if (typeof key === "object") {
-
- var v;
- for (v in key) {
- elem.setAttribute(v, key[v]);
- }
-
- } else {
- attr = elem.getAttribute(key);
- if (attr || attr === "0") {
- attr = isNaN(attr) ? attr : (attr - 0);
- }
- return attr;
- }
- } else {
- return proxied.apply(this, arguments);
- }
- }
- return this;
- };
- }());
|