javascript - How to determine if browser supports properties on event object? -
some touch-enabled browsers (such mobile safari) have scale
, rotation
property available on event
object events such touchmove
.
i can detect support scale
property so...
document.body.addeventlistener("touchmove", function(event) { var supportsscaleproperty = !!event.scale; });
however, there way detect without having bind listener , property in callback?
for example, if worked?
var supportsscaleproperty = !!(new customevent("touchevents")).scale;
i tried looking @ createevent()
, it's deprecated. looked @ new customevent()
, wasn't sure string use touch events.
you may able use event
constructor:
if ('scale' in new event("touchmove")) { // has }
Comments
Post a Comment