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

Function computeCssStyles

lib/test/angular/1.5.0/angular-animate.js:780–804  ·  view source on GitHub ↗
($window, element, properties)

Source from the content-addressed store, hash-verified

778}
779
780function 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
806function parseMaxTime(str) {
807 var maxValue = 0;

Callers 2

computeCachedCssStylesFunction · 0.70

Calls 2

forEachFunction · 0.70
parseMaxTimeFunction · 0.70

Tested by

no test coverage detected