[Webkit-unassigned] [Bug 139681] Touch support is reported even when the device doesn't have a touch screen

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 8 08:59:32 PST 2015


https://bugs.webkit.org/show_bug.cgi?id=139681

--- Comment #8 from Darin Adler <darin at apple.com> ---
It really bothers me that website developers check for the presence of the "ontouchstart" property in the window object as the way to detect "touch capabilities". The whole point of that article is that it’s a bad idea. It’s certainly a hack, not a well considered technique. These "on<xxx>" properties are conveniences that allow you to set up an event listener without calling the addEventListener function. But the presence of such a convenience doesn’t tell you what events the webpage will receive! I don’t think the fact that a web engine allows you to set up a handler for the "touchstart" event means that you can count on the device being used to generate such events. It's like assuming because I know a few words of Spanish that I would prefer that you bring me the menu in Spanish rather than the one in English that I can read much more easily.

Some WebKit ports want have capabilities dynamically determined at runtime, with all traces of those capabilities hidden from the web platform. This is challenging to do in an efficient way. The normal way WebKit exposes DOM APIs doesn’t make it easy to have ones that are super-efficient but also dynamically present or not based on runtime capabilities. Because the Chrome team was vitally interested in having experimental features that could be turned on and off in their web browser, they made adding this feature to WebKit a high priority, but implemented it only for V8. That might have been because the engineers doing this work didn’t know how to do it efficiently for WebKit’s native JavaScript engine, or it might just be that they didn’t care about the feature outside their own use of it. I’m not sure everyone that is part of the WebKit project today agrees we want this feature in the WebKit tree. We should discuss what it would take to do this. The technical details are 

PS: To make these websites work, we don’t want "ontouchstart" to return false, we want the expression '"ontouchstart" in window' to return false. It's no better and not helpful to talk about "typeof window.ontouchstart != 'undefined'" for multiple reasons. For one thing, presumably the websites doing these checks already exist, so it’s not like we can change them, so I think that stops the conversation before it even begins.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150108/1c4ada13/attachment-0002.html>


More information about the webkit-unassigned mailing list