Hacker News new | ask | show | jobs
by Zarel 3987 days ago
My most recent problem unsolvable by feature detection has to do with the HTML5 `dragend` event:

https://github.com/Zarel/Pokemon-Showdown-Client/commit/30f2...

In Chrome, event.pageX/pageY refer to the position of the top left corner of the drag-preview-image, relative to the top left corner of the page.

In Safari, event.pageX/pageY refer to the position of the mouse curser relative to (0, window.innerHeight * 2 - window.outerHeight), a point slightly above the bottom left corner of the screen.

(Neither of these is spec, which as far as I know says that event.pageX/pageY should be the position of the mouse cursor, relative to the top left corner of the page.)

I eventually got around it by storing values from the `drop` event, but anyone who needed these values from the `dragend` event would be screwed.

My next most recent problem unsolvable by feature detection has to do with HTML5 Notification, whose API was massively changed recently. Attempting to use the new API on old versions of Chrome would cause the render process to crash (not just throw an error you could catch in a try-block, but actually crash like http://i.stack.imgur.com/DjdCX.png ). Of course, using the old API on new versions of Chrome would fail silently, so there was zero way to reliably deliver a notification to the latest version of Chrome without crashing older versions or using user agent detection:

https://code.google.com/p/chromium/issues/detail?id=139594