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

Function computeCssStyles

lib/test/angular/1.8.0/angular-animate.js:763–787  ·  view source on GitHub ↗
($window, element, properties)

Source from the content-addressed store, hash-verified

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

Callers 2

computeCachedCssStylesFunction · 0.70

Calls 2

forEachFunction · 0.70
parseMaxTimeFunction · 0.70

Tested by

no test coverage detected