Skip to content

Commit 6097503

Browse files
committed
Event: provide verbose comment for focus(in | out) & rename support prop
Closes gh-2312
1 parent e1e96e3 commit 6097503

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

src/event.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -748,15 +748,21 @@ jQuery.each({
748748
};
749749
});
750750

751-
// Support: Firefox, Chrome, Safari
752-
// Create "bubbling" focus and blur events
753-
if ( !support.focusinBubbles ) {
751+
// Support: Firefox
752+
// Firefox doesn't have focus(in | out) events
753+
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
754+
//
755+
// Support: Chrome, Safari
756+
// focus(in | out) events fire after focus & blur events,
757+
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
758+
// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
759+
if ( !support.focusin ) {
754760
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
755761

756762
// Attach a single capturing handler on the document while someone wants focusin/focusout
757763
var handler = function( event ) {
758-
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
759-
};
764+
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
765+
};
760766

761767
jQuery.event.special[ fix ] = {
762768
setup: function() {

src/event/support.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ define([
22
"../var/support"
33
], function( support ) {
44

5-
support.focusinBubbles = "onfocusin" in window;
5+
support.focusin = "onfocusin" in window;
66

77
return support;
88

test/unit/support.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
6262
"clearCloneStyle": true,
6363
"cors": true,
6464
"createHTMLDocument": true,
65-
"focusinBubbles": false,
65+
"focusin": false,
6666
"noCloneChecked": true,
6767
"optDisabled": true,
6868
"optSelected": true,
@@ -80,7 +80,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
8080
"clearCloneStyle": false,
8181
"cors": true,
8282
"createHTMLDocument": true,
83-
"focusinBubbles": true,
83+
"focusin": true,
8484
"noCloneChecked": false,
8585
"optDisabled": true,
8686
"optSelected": false,
@@ -98,7 +98,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
9898
"clearCloneStyle": false,
9999
"cors": false,
100100
"createHTMLDocument": true,
101-
"focusinBubbles": true,
101+
"focusin": true,
102102
"noCloneChecked": false,
103103
"optDisabled": true,
104104
"optSelected": false,
@@ -116,7 +116,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
116116
"clearCloneStyle": true,
117117
"cors": true,
118118
"createHTMLDocument": false,
119-
"focusinBubbles": false,
119+
"focusin": false,
120120
"noCloneChecked": true,
121121
"optDisabled": true,
122122
"optSelected": true,
@@ -134,7 +134,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
134134
"clearCloneStyle": true,
135135
"cors": true,
136136
"createHTMLDocument": true,
137-
"focusinBubbles": false,
137+
"focusin": false,
138138
"noCloneChecked": true,
139139
"optDisabled": true,
140140
"optSelected": true,
@@ -152,7 +152,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
152152
"clearCloneStyle": true,
153153
"cors": true,
154154
"createHTMLDocument": true,
155-
"focusinBubbles": false,
155+
"focusin": false,
156156
"noCloneChecked": true,
157157
"optDisabled": true,
158158
"optSelected": true,
@@ -170,7 +170,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
170170
"clearCloneStyle": true,
171171
"cors": true,
172172
"createHTMLDocument": false,
173-
"focusinBubbles": false,
173+
"focusin": false,
174174
"noCloneChecked": true,
175175
"optDisabled": true,
176176
"optSelected": true,
@@ -188,7 +188,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
188188
"clearCloneStyle": true,
189189
"cors": true,
190190
"createHTMLDocument": true,
191-
"focusinBubbles": false,
191+
"focusin": false,
192192
"noCloneChecked": true,
193193
"optDisabled": true,
194194
"optSelected": true,
@@ -206,7 +206,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
206206
"clearCloneStyle": true,
207207
"cors": true,
208208
"createHTMLDocument": true,
209-
"focusinBubbles": false,
209+
"focusin": false,
210210
"noCloneChecked": true,
211211
"optDisabled": true,
212212
"optSelected": true,
@@ -224,7 +224,7 @@ testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
224224
"clearCloneStyle": false,
225225
"cors": true,
226226
"createHTMLDocument": true,
227-
"focusinBubbles": false,
227+
"focusin": false,
228228
"noCloneChecked": true,
229229
"optDisabled": false,
230230
"optSelected": true,

0 commit comments

Comments
 (0)