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

Function computeCssStyles

lib/test/angular/1.7.0/angular-animate.js:761–785  ·  view source on GitHub ↗
($window, element, properties)

Source from the content-addressed store, hash-verified

759}
760
761function 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
787function parseMaxTime(str) {
788 var maxValue = 0;

Callers 2

computeCachedCssStylesFunction · 0.70

Calls 2

forEachFunction · 0.70
parseMaxTimeFunction · 0.70

Tested by

no test coverage detected