Skip to content

Commit

Permalink
Merge pull request Modernizr#386 from ausi/master
Browse files Browse the repository at this point in the history
feature detection for pointer-events - closes Modernizr#80
  • Loading branch information
paulirish committed Oct 5, 2011
2 parents f0b12fb + 03ee15d commit a662f77
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions feature-detects/css-pointerevents.js
@@ -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;
});

0 comments on commit a662f77

Please sign in to comment.