Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
iOS6's handleEvent not works by Function's property
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
document.addEventListener('DOMContentLoaded', function() {
function Klass() {
Klass.handleEvent = function() {
alert('Function property');
Klass.prototype.handleEvent = function() {
// Not good
document.addEventListener('touchstart', Klass, false);
// Good
document.addEventListener('touchstart', new Klass, false);
}, false);
<h1>Click the document.</h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment