Code coverage report for dgrid\util\has-css3.js

Statements: 64% (16 / 25)      Branches: 37.5% (3 / 8)      Functions: 66.67% (4 / 6)      Lines: 64% (16 / 25)      Ignored: none     

All files » dgrid/util/ » has-css3.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 644                   4   4 4     4   4                           4 4     4       4       4   4 4     4 4                   4    
define([
	'dojo/has'
], function (has) {
	// This module defines feature tests for CSS3 features such as transitions.
	// The css-transitions, css-transforms, and css-transforms3d has-features
	// can report either boolean or string:
	// * false indicates no support
	// * true indicates prefix-less support
	// * string indicates the vendor prefix under which the feature is supported
 
	var cssPrefixes = ['ms', 'O', 'Moz', 'Webkit'];
 
	function testStyle(element, property) {
		var style = element.style,
			i;
 
		Eif (property in style) {
			// Standard, no prefix
			return true;
		}
		property = property.slice(0, 1).toUpperCase() + property.slice(1);
		for (i = cssPrefixes.length; i--;) {
			if ((cssPrefixes[i] + property) in style) {
				// Vendor-specific css property prefix
				return cssPrefixes[i];
			}
		}
 
		// Otherwise, not supported
		return false;
	}
 
	has.add('css-transitions', function (global, doc, element) {
		return testStyle(element, 'transitionProperty');
	});
 
	has.add('css-transforms', function (global, doc, element) {
		return testStyle(element, 'transform');
	});
 
	has.add('css-transforms3d', function (global, doc, element) {
		return testStyle(element, 'perspective');
	});
 
	has.add('transitionend', function () {
		// Infer transitionend event name based on CSS transitions has-feature.
		var tpfx = has('css-transitions');
		Iif (!tpfx) {
			return false;
		}
		Eif (tpfx === true) {
			return 'transitionend';
		}
		return {
			ms: 'MSTransitionEnd',
			O: 'oTransitionEnd',
			Moz: 'transitionend',
			Webkit: 'webkitTransitionEnd'
		}[tpfx];
	});
 
	return has;
});