https://bugzilla.wikimedia.org/show_bug.cgi?id=65608

--- Comment #1 from Krinkle <[email protected]> ---
(In reply to Tisza Gergő from comment #0)
> jQuery 1.9 has a nasty change in how triggered focus events are handled.
> There is some documentation on it at [1] which states "jQuery has always
> ensured that a call to .trigger("focus") or .focus() consistently runs any
> attached event handlers, even if the element cannot be focused, and jQuery
> 1.9 continues to do that."
> 
> This is a bald-faced lie. 

No. This is taken out of context. Full two paragraph froms
http://jquery.com/upgrade-guide/1.9/#order-of-triggered-quot-focus-quot-events

"When the user clicks or tabs into a form element to bring it into focus, the
browser first fires a blur event for the previously focused element and then a
focus event for the new element. Prior to 1.9, a trigger()ed focus event using
either .trigger("focus") or .focus() would fire a focus event for the new
element and then the blur event for the previous element before finally
actually focusing the element. In 1.9 this behavior has been changed to reflect
the same order as if the user had caused the focus change."

"With native DOM focus events, the browser only calls a focus event handler if
the target element is not already focused and can also successfully be focused.
jQuery has always ensured that a call to .trigger("focus") or .focus()
consistently runs any attached event handlers, even if the element cannot be
focused, and jQuery 1.9 continues to do that. This is different behavior than
the DOM .focus() method, which will not call event handlers in many cases
including where the element is already focused or the element is disabled."

The first paragraph explains the fixed behaviour where it no longer manually
fires jQuery-bound event handlers first, and only trigger native focus() after
– which then triggers blur first – thus causing the blur to effectively happen
after the focus handlers are fired (blur bubbles back into jQuery and triggers
those).

As a result of using the native handlers and triggering them in the right
order, elements that are never focusable to begin with are no longer getting
any handlers triggers. Previously they were getting a partial/incomplete event
sequence (only the jQuery-bound handlers, but no blur or native focus of
course).

While the second paragraph is somewhat ambiguous, I don't think the sentence
you cited is saying it will continue to run on all elements (including those
not focusable in general). As emphasised by the sentence that follows that one,
it is saying they will run the handlers even if the element is already focussed
(which is also an instance of "cannot be focussed", albeit temporarily).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to