Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Use readystatechange technique to register touch event listeners
Browse files Browse the repository at this point in the history
DOMContentLoaded may not work if loaded asynchronusly
Similar to googlearchive/PointerGestures@296fb7c
Related to Polymer/platform-dev#11
  • Loading branch information
dfreedm committed Mar 2, 2014
1 parent ccf2629 commit f2964bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@
},
// register all touch-action = none nodes on document load
installOnLoad: function() {
document.addEventListener('DOMContentLoaded', this.installNewSubtree.bind(this, document));
document.addEventListener('readystatechange', function() {
if (document.readyState === 'complete') {
this.installNewSubtree(document);
}
}.bind(this));
},
isElement: function(n) {
return n.nodeType === Node.ELEMENT_NODE;
Expand Down

0 comments on commit f2964bc

Please sign in to comment.