From 48194a75fed233eab8c8cf9788e7a26d42d04b82 Mon Sep 17 00:00:00 2001 From: frankiefu Date: Mon, 4 Nov 2013 15:47:03 -0800 Subject: [PATCH] polymer-ui-icon: support 4 value syntax returns from getComputedStyle backgroundPosition --- polymer-ui-icon/polymer-ui-icon.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/polymer-ui-icon/polymer-ui-icon.html b/polymer-ui-icon/polymer-ui-icon.html index 0ca34fa..a8e2266 100644 --- a/polymer-ui-icon/polymer-ui-icon.html +++ b/polymer-ui-icon/polymer-ui-icon.html @@ -155,8 +155,10 @@ var themes = {}; function calcThemeOffset(theme, node) { if (themes[theme] === undefined) { - var offset = parseFloat( - getComputedStyle(node).backgroundPosition.split(' ').shift()); + var bp = getComputedStyle(node).backgroundPosition.split(' '); + // support 4 value syntax (https://code.google.com/p/chromium/issues/detail?id=310977) + var l = bp.length === 4 ? bp[1] : bp[0]; + var offset = parseFloat(l); themes[theme] = offset; } return themes[theme];