Browsers could do so much more to optimize delegated handlers at a lower level. Most of the CSS selector parsing and grouping optimizations could be applied here. No javascript code ever has to be invoked if the selector doesn't match.
document.addDelegatedEventListener("mouseover", ".tooltip", listener)
Possibly coming with Web Components.
document.listen({selector: ".tooltip", type: "mouseover", handler: handler})
Theres no way to figure what URL you ended up at if the request follows a redirect.
XMLHttpRequest#requestLocation
Useful when storing associated state data. Like a cached dom fragments associated with previous pages.
Adding (new Date).getTime()
to the state object is a current workaround.
The direction (forward or back) that triggered the popstate event. Useful for sliding animations.
window.onpopstate = function(event) {
event.direction #=> "back"
}
Smarter click simulating. Theres more to it than firing a 'click' event and changing location.href
unless default was prevented. Equivalent of WebKit dispatchSimulatedClick.
target.simulateClick()
Sometimes you just need to know where the mouse is at a given moment rather than anytime it changes.
window.mouse.clientY
window.mouse.screenY
Current workaround:
var lastMouseMoveEvent;
window.addEventListener('mousemove', function(event) { lastMouseMoveEvent = event }, true);
Kinda specific to OSX, the cursor will be hidden when you start typing. This feature is provided by setHiddenUntilMouseMoves
. Useful for detecting "typing" and "keyboard nav" modes vs mousing.
window.isMouseHidden()
window.addEventListener("mousehide", ...)
window.addEventListener("mouseshow", …)
Finally get away from this keyCode
nonsense. Its standarized as part of DOM Level 3 Events but hardly any browsers support it yet.
We have accesskeys, but they require ctrl+
. Supporting any modifier would be nice.
<input type=search hotkey="s">
The missing complement to transitionEnd
.
See http://snook.ca/archives/javascript/preparetransition-jquery-plugin