($window, element, properties)
| 778 | } |
| 779 | |
| 780 | function computeCssStyles($window, element, properties) { |
| 781 | var styles = Object.create(null); |
| 782 | var detectedStyles = $window.getComputedStyle(element) || {}; |
| 783 | forEach(properties, function(formalStyleName, actualStyleName) { |
| 784 | var val = detectedStyles[formalStyleName]; |
| 785 | if (val) { |
| 786 | var c = val.charAt(0); |
| 787 | |
| 788 | // only numerical-based values have a negative sign or digit as the first value |
| 789 | if (c === '-' || c === '+' || c >= 0) { |
| 790 | val = parseMaxTime(val); |
| 791 | } |
| 792 | |
| 793 | // by setting this to null in the event that the delay is not set or is set directly as 0 |
| 794 | // then we can still allow for negative values to be used later on and not mistake this |
| 795 | // value for being greater than any other negative value. |
| 796 | if (val === 0) { |
| 797 | val = null; |
| 798 | } |
| 799 | styles[actualStyleName] = val; |
| 800 | } |
| 801 | }); |
| 802 | |
| 803 | return styles; |
| 804 | } |
| 805 | |
| 806 | function parseMaxTime(str) { |
| 807 | var maxValue = 0; |
no test coverage detected