Skip to content

Commit

Permalink
Added DOM PointerEvents test as Modernizr.pointerevents
Browse files Browse the repository at this point in the history
  • Loading branch information
stucox committed Jan 29, 2013
1 parent 9fad387 commit 8966f82
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions config-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"test/notification",
"test/pagevisibility-api",
"test/performance",
"test/pointerevents",
"test/pointerlock-api",
"test/postmessage",
"test/quota-management-api",
Expand Down
20 changes: 20 additions & 0 deletions feature-detects/pointerevents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
define(['Modernizr', 'domPrefixes', 'hasEvent'], function( Modernizr, domPrefixes, hasEvent ) {
// **Test name hijacked!**
// Now refers to W3C DOM PointerEvents spec: http://www.w3.org/Submission/pointer-events/
// For CSS pointer-events test, see feature-detects/css/pointerevents.js
Modernizr.addTest('pointerevents', function () {
// Cannot use `.prefixed()` for events, so test each prefix
var bool = false,
i = domPrefixes.length;

// Don't forget un-prefixed...
bool = Modernizr.hasEvent('pointerdown');

while (i-- && !bool) {
if (hasEvent(domPrefixes[i] + 'pointerdown')) {
bool = true;
}
}
return bool;
});
});
1 change: 1 addition & 0 deletions modular.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ <h1>Config JSON</h1>
"test/notification",
"test/pagevisibility-api",
"test/performance",
"test/pointerevents",
"test/pointerlock-api",
"test/postmessage",
"test/quota-management-api",
Expand Down
1 change: 1 addition & 0 deletions modulizr/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ <h3>Choose the features you want to test for:</h3>
<li id="flexbox"><input type="checkbox" value="flexbox" /> FlexBox CSS Model</li>
<li id="webgl"><input type="checkbox" value="webgl" /> WebGL</li>
<li id="touchevents"><input type="checkbox" value="touchevents" /> Touch Events</li>
<li id="pointerevents"><input type="checkbox" value="pointerevents" /> Pointer Events</li>
<li id="postmessage"><input type="checkbox" value="postmessage" /> PostMessage</li>
<li id="textshadow"><input type="checkbox" value="textshadow" /> text-shadow</li>
<li id="inlinesvg"><input type="checkbox" value="inlinesvg" /> Inline SVG</li>
Expand Down
1 change: 1 addition & 0 deletions modulizr/js/modulizr.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"canvastext",
"webgl",
"touchevents",
"pointerevents",
"geolocation",
"postmessage",
"websqldatabase",
Expand Down

0 comments on commit 8966f82

Please sign in to comment.