Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Fix box-shadow parsing for IE9
Browse files Browse the repository at this point in the history
  • Loading branch information
scf2k committed Nov 19, 2014
1 parent bf833b5 commit b24fe68
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/browser/client-scripts/gemini.js
Expand Up @@ -126,19 +126,22 @@
}

function parseBoxShadow(value) {
var regex = /.+? ([-+]?\d*\.?\d+)px ([-+]?\d*\.?\d+)px ([-+]?\d*\.?\d+)px ([-+]?\d*\.?\d+)px( inset)?/,
var regex = /([-+]?\d*\.?\d+)px (?:([-+]?\d*\.?\d+)px)? (?:([-+]?\d*\.?\d+)px)? (?:([-+]?\d*\.?\d+)px)?/,
values = value.split(','),
results = [],
match;

while ((match = value.match(regex))) {
results.push({
offsetX: +match[1],
offsetY: +match[2],
blurRadius: +match[3],
spreadRadius: +match[4],
inset: !!match[5]
});
value = value.substring(match.index + match[0].length);
for (value in values) {
value = values[value];
if ((match = value.match(regex))) {
results.push({
offsetX: +match[1],
offsetY: +match[2] || 0,
blurRadius: +match[3] || 0,
spreadRadius: +match[4] || 0,
inset: value.indexOf('inset') !== -1
});
}
}
return results;
}
Expand Down

0 comments on commit b24fe68

Please sign in to comment.