Skip to content
This repository
Browse code

Added Modernizr's feature test for CSS pointer-events property

  • Loading branch information...
commit e083da4b2b09bb5bdaf8408cb0371bca2eef2470 1 parent 26bd1ef
Ghislain Seguin authored June 20, 2012

Showing 1 changed file with 22 additions and 1 deletion. Show diff stats Hide diff stats

  1. 23  js/jquery.mobile.support.js
23  js/jquery.mobile.support.js
@@ -85,6 +85,26 @@ function baseTagTest() {
85 85
 	return rebase.indexOf( fauxBase ) === 0;
86 86
 }
87 87
 
  88
+// Thanks Modernizr
  89
+function cssPointerEventsTest() {
  90
+	var element = document.createElement('x'),
  91
+		documentElement = document.documentElement,
  92
+		getComputedStyle = window.getComputedStyle,
  93
+		supports;
  94
+
  95
+	if( !( 'pointerEvents' in element.style ) ){
  96
+		return false;
  97
+	}
  98
+
  99
+	element.style.pointerEvents = 'auto';
  100
+	element.style.pointerEvents = 'x';
  101
+    documentElement.appendChild(element);
  102
+	supports = getComputedStyle &&
  103
+    getComputedStyle( element, '' ).pointerEvents === 'auto';
  104
+	documentElement.removeChild( element );
  105
+    return !!supports;
  106
+}
  107
+
88 108
 
89 109
 // non-UA-based IE version check by James Padolsey, modified by jdalton - from http://gist.github.com/527683
90 110
 // allows for inclusion of IE 6+, including Windows Mobile 7
@@ -113,7 +133,8 @@ $.extend( $.support, {
113 133
 	cssTransform3d: transform3dTest(),
114 134
 	boxShadow: !!propExists( "boxShadow" ) && !bb,
115 135
 	scrollTop: ( "pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[ 0 ] ) && !webos && !operamini,
116  
-	dynamicBaseTag: baseTagTest()
  136
+	dynamicBaseTag: baseTagTest(),
  137
+	cssPointerEvents: cssPointerEventsTest()
117 138
 });
118 139
 
119 140
 fakeBody.remove();

0 notes on commit e083da4

Please sign in to comment.
Something went wrong with that request. Please try again.