css-pointerevents.js 840 B

12345678910111213141516171819202122232425
  1. // developer.mozilla.org/en/CSS/pointer-events
  2. // Test and project pages:
  3. // ausi.github.com/Feature-detection-technique-for-pointer-events/
  4. // github.com/ausi/Feature-detection-technique-for-pointer-events/wiki
  5. // github.com/Modernizr/Modernizr/issues/80
  6. Modernizr.addTest('pointerevents', function(){
  7. var element = document.createElement('x'),
  8. documentElement = document.documentElement,
  9. getComputedStyle = window.getComputedStyle,
  10. supports;
  11. if(!('pointerEvents' in element.style)){
  12. return false;
  13. }
  14. element.style.pointerEvents = 'auto';
  15. element.style.pointerEvents = 'x';
  16. documentElement.appendChild(element);
  17. supports = getComputedStyle &&
  18. getComputedStyle(element, '').pointerEvents === 'auto';
  19. documentElement.removeChild(element);
  20. return !!supports;
  21. });