Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

feature detection for pointer-events #386

Merged
merged 1 commit into from Oct 5, 2011
Jump to file or symbol
Failed to load files and symbols.
+18 −0
Split
@@ -0,0 +1,18 @@
+// developer.mozilla.org/en/CSS/pointer-events
+// github.com/ausi/Feature-detection-technique-for-pointer-events
+Modernizr.addTest('pointerevents', function(){
+ var element = document.createElement('x'),
+ documentElement = document.documentElement,
+ getComputedStyle = window.getComputedStyle,
+ supports;
+ if(!('pointerEvents' in element.style)){
+ return false;
+ }
+ element.style.pointerEvents = 'auto';
+ element.style.pointerEvents = 'x';
+ documentElement.appendChild(element);
+ supports = getComputedStyle &&
+ getComputedStyle(element, '').pointerEvents === 'auto';
+ documentElement.removeChild(element);
+ return !!supports;
+});