Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8a74137

Browse files
authored
Event: Stop shimming focusin & focusout events
Latest versions of all browsers now implement focusin & focusout nativelyand they all converged on a common event order so it doesn't make much sensefor us to normalize it to a different order anymore.Note that it means we no longer guarantee that focusin fires before focusand focusout before blur.Fixesgh-4300Closesgh-4362
1 parent8fae212 commit8a74137

File tree

6 files changed

+35
-93
lines changed

6 files changed

+35
-93
lines changed

‎README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ Some example modules that can be excluded are:
9292
-**effects**: The`.animate()` method and its shorthands such as`.slideUp()` or`.hide("slow")`.
9393
-**event**: The`.on()` and`.off()` methods and all event functionality. Also removes`event/alias`.
9494
-**event/alias**: All event attaching/triggering shorthands like`.click()` or`.mouseover()`.
95-
-**event/focusin**: Cross-browser support for the focusin and focusout events.
96-
-**event/trigger**: The`.trigger()` and`.triggerHandler()` methods. Used by**alias** and**focusin** modules.
95+
-**event/trigger**: The`.trigger()` and`.triggerHandler()` methods. Used by the**alias** module.
9796
-**offset**: The`.offset()`,`.position()`,`.offsetParent()`,`.scrollLeft()`, and`.scrollTop()` methods.
9897
-**wrap**: The`.wrap()`,`.wrapAll()`,`.wrapInner()`, and`.unwrap()` methods.
9998
-**core/ready**: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks bound with`jQuery()` will simply be called immediately. However,`jQuery(document).ready()` will not be a function and`.on("ready", ...)` or similar will not be triggered.

‎src/event/focusin.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

‎src/event/support.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎src/jquery.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ define( [
1111
"./queue/delay",
1212
"./attributes",
1313
"./event",
14-
"./event/focusin",
1514
"./manipulation",
1615
"./manipulation/_evalUrl",
1716
"./wrap",

‎test/unit/event.js

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,39 +2946,62 @@ QUnit.test( "VML with special event handlers (trac-7071)", function( assert ) {
29462946
ns.remove();
29472947
});
29482948

2949-
QUnit.test("Check order of focusin/focusout events",function(assert){
2950-
assert.expect(2);
2949+
QUnit.test("focusout/focusin support",function(assert){
2950+
assert.expect(6);
2951+
2952+
varfocus,
2953+
parent=jQuery("<div>"),
2954+
input=jQuery("<input>"),
2955+
inputExternal=jQuery("<input>");
29512956

2952-
varfocus,blur,
2953-
input=jQuery("#name");
2957+
parent.append(input);
2958+
jQuery("#qunit-fixture").append(parent).append(inputExternal);
2959+
2960+
parent
2961+
.on("focus",function(){
2962+
assert.ok(false,"parent: focus not fired");
2963+
})
2964+
.on("focusin",function(){
2965+
assert.ok(true,"parent: focusin fired");
2966+
})
2967+
.on("blur",function(){
2968+
assert.ok(false,"parent: blur not fired");
2969+
})
2970+
.on("focusout",function(){
2971+
assert.ok(true,"parent: focusout fired");
2972+
});
29542973

29552974
input
29562975
.on("focus",function(){
2976+
assert.ok(true,"element: focus fired");
29572977
focus=true;
29582978
})
29592979
.on("focusin",function(){
2960-
assert.ok(!focus,"Focusin event should fire before focus does");
2961-
focus=true;
2980+
assert.ok(true,"element: focusin fired");
29622981
})
29632982
.on("blur",function(){
2964-
blur=true;
2983+
assert.ok(true,"parent:blurfired");
29652984
})
29662985
.on("focusout",function(){
2967-
assert.ok(!blur,"Focusout event should fire before blur does");
2968-
blur=true;
2986+
assert.ok(true,"element: focusout fired");
29692987
});
29702988

29712989
// gain focus
29722990
input.trigger("focus");
29732991

29742992
// then lose it
2975-
jQuery("#search").trigger("focus");
2993+
inputExternal.trigger("focus");
29762994

29772995
// cleanup
2996+
parent.off();
29782997
input.off();
29792998

29802999
// DOM focus is unreliable in TestSwarm
2981-
if(!focus){
3000+
if(QUnit.isSwarm&&!focus){
3001+
assert.ok(true,"GAP: Could not observe focus change");
3002+
assert.ok(true,"GAP: Could not observe focus change");
3003+
assert.ok(true,"GAP: Could not observe focus change");
3004+
assert.ok(true,"GAP: Could not observe focus change");
29823005
assert.ok(true,"GAP: Could not observe focus change");
29833006
assert.ok(true,"GAP: Could not observe focus change");
29843007
}

‎test/unit/support.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ testIframe(
6666
"clearCloneStyle":true,
6767
"cors":true,
6868
"createHTMLDocument":true,
69-
"focusin":false,
7069
"noCloneChecked":true,
7170
"optSelected":true,
7271
"pixelBoxStyles":true,
@@ -83,7 +82,6 @@ testIframe(
8382
"clearCloneStyle":false,
8483
"cors":true,
8584
"createHTMLDocument":true,
86-
"focusin":true,
8785
"noCloneChecked":false,
8886
"optSelected":false,
8987
"pixelBoxStyles":true,
@@ -100,7 +98,6 @@ testIframe(
10098
"clearCloneStyle":false,
10199
"cors":false,
102100
"createHTMLDocument":true,
103-
"focusin":true,
104101
"noCloneChecked":false,
105102
"optSelected":false,
106103
"pixelBoxStyles":true,
@@ -117,7 +114,6 @@ testIframe(
117114
"clearCloneStyle":true,
118115
"cors":true,
119116
"createHTMLDocument":true,
120-
"focusin":false,
121117
"noCloneChecked":true,
122118
"optSelected":true,
123119
"pixelBoxStyles":true,
@@ -134,7 +130,6 @@ testIframe(
134130
"clearCloneStyle":true,
135131
"cors":true,
136132
"createHTMLDocument":true,
137-
"focusin":false,
138133
"noCloneChecked":true,
139134
"optSelected":true,
140135
"pixelBoxStyles":true,
@@ -151,7 +146,6 @@ testIframe(
151146
"clearCloneStyle":true,
152147
"cors":true,
153148
"createHTMLDocument":true,
154-
"focusin":false,
155149
"noCloneChecked":true,
156150
"optSelected":true,
157151
"pixelBoxStyles":false,
@@ -168,7 +162,6 @@ testIframe(
168162
"clearCloneStyle":true,
169163
"cors":true,
170164
"createHTMLDocument":true,
171-
"focusin":false,
172165
"noCloneChecked":true,
173166
"optSelected":true,
174167
"pixelBoxStyles":true,
@@ -185,7 +178,6 @@ testIframe(
185178
"clearCloneStyle":true,
186179
"cors":true,
187180
"createHTMLDocument":true,
188-
"focusin":false,
189181
"noCloneChecked":true,
190182
"optSelected":true,
191183
"pixelBoxStyles":true,
@@ -202,7 +194,6 @@ testIframe(
202194
"clearCloneStyle":true,
203195
"cors":true,
204196
"createHTMLDocument":true,
205-
"focusin":false,
206197
"noCloneChecked":true,
207198
"optSelected":true,
208199
"pixelBoxStyles":true,
@@ -219,7 +210,6 @@ testIframe(
219210
"clearCloneStyle":true,
220211
"cors":true,
221212
"createHTMLDocument":true,
222-
"focusin":false,
223213
"noCloneChecked":true,
224214
"optSelected":true,
225215
"pixelBoxStyles":false,
@@ -236,7 +226,6 @@ testIframe(
236226
"clearCloneStyle":true,
237227
"cors":true,
238228
"createHTMLDocument":false,
239-
"focusin":false,
240229
"noCloneChecked":true,
241230
"optSelected":true,
242231
"pixelBoxStyles":false,
@@ -253,7 +242,6 @@ testIframe(
253242
"clearCloneStyle":true,
254243
"cors":true,
255244
"createHTMLDocument":true,
256-
"focusin":false,
257245
"noCloneChecked":true,
258246
"optSelected":true,
259247
"pixelBoxStyles":false,
@@ -270,7 +258,6 @@ testIframe(
270258
"clearCloneStyle":true,
271259
"cors":true,
272260
"createHTMLDocument":true,
273-
"focusin":false,
274261
"noCloneChecked":true,
275262
"optSelected":true,
276263
"pixelBoxStyles":false,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp