mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-22 20:25:49 +00:00
fix for unittest "fabric.Parser.parseStyleAttribute" compliance in < IE8
This commit is contained in:
parent
26d6176928
commit
17931fb764
1 changed files with 6 additions and 11 deletions
|
|
@ -266,19 +266,14 @@
|
|||
style = element.getAttribute('style');
|
||||
if (style) {
|
||||
if (typeof style == 'string') {
|
||||
style = style.replace(/;$/, '').split(';');
|
||||
oStyle = style.reduce(function(memo, current) {
|
||||
var attr = current.split(':'),
|
||||
key = attr[0].trim(),
|
||||
value = attr[1].trim();
|
||||
memo[key] = value;
|
||||
return memo;
|
||||
}, { });
|
||||
}
|
||||
else {
|
||||
style = style.replace(/;$/, '').split(';').forEach(function (current) {
|
||||
var attr = current.split(':');
|
||||
oStyle[attr[0].trim().toLowerCase()] = attr[1].trim();
|
||||
});
|
||||
} else {
|
||||
for (var prop in style) {
|
||||
if (typeof style[prop] !== 'undefined') {
|
||||
oStyle[prop] = style[prop];
|
||||
oStyle[prop.toLowerCase()] = style[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue