($window, element, properties)
| 759 | } |
| 760 | |
| 761 | function computeCssStyles($window, element, properties) { |
| 762 | var styles = Object.create(null); |
| 763 | var detectedStyles = $window.getComputedStyle(element) || {}; |
| 764 | forEach(properties, function(formalStyleName, actualStyleName) { |
| 765 | var val = detectedStyles[formalStyleName]; |
| 766 | if (val) { |
| 767 | var c = val.charAt(0); |
| 768 | |
| 769 | // only numerical-based values have a negative sign or digit as the first value |
| 770 | if (c === '-' || c === '+' || c >= 0) { |
| 771 | val = parseMaxTime(val); |
| 772 | } |
| 773 | |
| 774 | // by setting this to null in the event that the delay is not set or is set directly as 0 |
| 775 | // then we can still allow for negative values to be used later on and not mistake this |
| 776 | // value for being greater than any other negative value. |
| 777 | if (val === 0) { |
| 778 | val = null; |
| 779 | } |
| 780 | styles[actualStyleName] = val; |
| 781 | } |
| 782 | }); |
| 783 | |
| 784 | return styles; |
| 785 | } |
| 786 | |
| 787 | function parseMaxTime(str) { |
| 788 | var maxValue = 0; |
no test coverage detected