($window, element, properties)
| 603 | }; |
| 604 | |
| 605 | function computeCssStyles($window, element, properties) { |
| 606 | var styles = Object.create(null); |
| 607 | var detectedStyles = $window.getComputedStyle(element) || {}; |
| 608 | forEach(properties, function(formalStyleName, actualStyleName) { |
| 609 | var val = detectedStyles[formalStyleName]; |
| 610 | if (val) { |
| 611 | var c = val.charAt(0); |
| 612 | |
| 613 | // only numerical-based values have a negative sign or digit as the first value |
| 614 | if (c === '-' || c === '+' || c >= 0) { |
| 615 | val = parseMaxTime(val); |
| 616 | } |
| 617 | |
| 618 | // by setting this to null in the event that the delay is not set or is set directly as 0 |
| 619 | // then we can still allow for zegative values to be used later on and not mistake this |
| 620 | // value for being greater than any other negative value. |
| 621 | if (val === 0) { |
| 622 | val = null; |
| 623 | } |
| 624 | styles[actualStyleName] = val; |
| 625 | } |
| 626 | }); |
| 627 | |
| 628 | return styles; |
| 629 | } |
| 630 | |
| 631 | function parseMaxTime(str) { |
| 632 | var maxValue = 0; |
no test coverage detected