From 17931fb764299109a6a6f2ad9ad0bc45e33427da Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Tue, 17 Jan 2012 15:24:25 +0100 Subject: [PATCH] fix for unittest "fabric.Parser.parseStyleAttribute" compliance in < IE8 --- src/parser.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/parser.js b/src/parser.js index b8dc1a86..53512fa3 100644 --- a/src/parser.js +++ b/src/parser.js @@ -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]; } } }