Created
August 10, 2012 02:23
-
-
Save sdesai/3310429 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(), | |
url = 'http://localhost/YuiWip/sb/phantomtest.html'; | |
page.open(url, function(status) { | |
var results = page.evaluate(function() { | |
return ("ontouchstart" in window); | |
}); | |
console.log(results); | |
results = page.evaluate(function() { | |
var foo = "not invoked"; | |
document.addEventListener("touchstart", function() { | |
foo = "invoked"; | |
}, false); | |
var customEvent = document.createEvent("TouchEvent"); | |
customEvent.initTouchEvent("touchstart", true, true, window, 1, | |
10, 10, 10, 10, | |
false, false, false, false, | |
document.createTouchList(document.createTouch(window, document, 1, 10, 10, 10, 10)), // touches[0] | |
document.createTouchList(document.createTouch(window, document, 1, 10, 10, 10, 10)), | |
document.createTouchList(), | |
1.0, 1.0); | |
document.dispatchEvent(customEvent); | |
return foo; | |
}); | |
console.log(results); | |
phantom.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment