MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / computeCssStyles

Function computeCssStyles

lib/test/angular/1.4.3/angular-animate.js:605–629  ·  view source on GitHub ↗
($window, element, properties)

Source from the content-addressed store, hash-verified

603};
604
605function 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
631function parseMaxTime(str) {
632 var maxValue = 0;

Callers 2

computeCachedCssStylesFunction · 0.70

Calls 2

forEachFunction · 0.70
parseMaxTimeFunction · 0.70

Tested by

no test coverage detected