Merge pull request #381 from ThomasBrierley/issue_373

Fixed equal.js aggressive numeric type capture regression
master
Dmitry Baranovskiy 2016-07-30 18:16:40 +10:00 committed by GitHub
commit 378b3a56b6
1 changed files with 7 additions and 7 deletions

View File

@ -121,13 +121,6 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
eve.on("snap.util.equal", function (name, b) { eve.on("snap.util.equal", function (name, b) {
var A, B, a = Str(this.attr(name) || ""), var A, B, a = Str(this.attr(name) || ""),
el = this; el = this;
if (isNumeric(a) && isNumeric(b)) {
return {
from: parseFloat(a),
to: parseFloat(b),
f: getNumber
};
}
if (names[name] == "colour") { if (names[name] == "colour") {
A = Snap.color(a); A = Snap.color(a);
B = Snap.color(b); B = Snap.color(b);
@ -174,6 +167,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
f: function (val) { return val; } f: function (val) { return val; }
}; };
} }
if (isNumeric(a) && isNumeric(b)) {
return {
from: parseFloat(a),
to: parseFloat(b),
f: getNumber
};
}
var aUnit = a.match(reUnit), var aUnit = a.match(reUnit),
bUnit = Str(b).match(reUnit); bUnit = Str(b).match(reUnit);
if (aUnit && arrayEqual(aUnit, bUnit)) { if (aUnit && arrayEqual(aUnit, bUnit)) {