Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
88068f82
Commit
88068f82
authored
Oct 13, 2010
by
Justin Meyer
Committed by
jeresig
Oct 13, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that focusin/focusout bubbles in non-IE browsers.
parent
39addc87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
event.js
src/event.js
+9
-4
event.js
test/unit/event.js
+15
-1
No files found.
src/event.js
View file @
88068f82
...
@@ -7,7 +7,8 @@ var rnamespaces = /\.(.*)$/,
...
@@ -7,7 +7,8 @@ var rnamespaces = /\.(.*)$/,
rescape
=
/
[^\w\s
.|`
]
/g
,
rescape
=
/
[^\w\s
.|`
]
/g
,
fcleanup
=
function
(
nm
)
{
fcleanup
=
function
(
nm
)
{
return
nm
.
replace
(
rescape
,
"
\\
$&"
);
return
nm
.
replace
(
rescape
,
"
\\
$&"
);
};
},
focusCounts
=
{
focusin
:
0
,
focusout
:
0
};
/*
/*
* A number of helper functions used for managing events.
* A number of helper functions used for managing events.
...
@@ -855,17 +856,21 @@ if ( document.addEventListener ) {
...
@@ -855,17 +856,21 @@ if ( document.addEventListener ) {
jQuery
.
each
({
focus
:
"focusin"
,
blur
:
"focusout"
},
function
(
orig
,
fix
)
{
jQuery
.
each
({
focus
:
"focusin"
,
blur
:
"focusout"
},
function
(
orig
,
fix
)
{
jQuery
.
event
.
special
[
fix
]
=
{
jQuery
.
event
.
special
[
fix
]
=
{
setup
:
function
()
{
setup
:
function
()
{
this
.
addEventListener
(
orig
,
handler
,
true
);
if
(
focusCounts
[
fix
]
++
===
0
)
{
document
.
addEventListener
(
orig
,
handler
,
true
);
}
},
},
teardown
:
function
()
{
teardown
:
function
()
{
this
.
removeEventListener
(
orig
,
handler
,
true
);
if
(
--
focusCounts
[
fix
]
===
0
)
{
document
.
removeEventListener
(
orig
,
handler
,
true
);
}
}
}
};
};
function
handler
(
e
)
{
function
handler
(
e
)
{
e
=
jQuery
.
event
.
fix
(
e
);
e
=
jQuery
.
event
.
fix
(
e
);
e
.
type
=
fix
;
e
.
type
=
fix
;
return
jQuery
.
event
.
handle
.
call
(
this
,
e
);
return
jQuery
.
event
.
trigger
(
e
,
null
,
e
.
target
);
}
}
});
});
}
}
...
...
test/unit/event.js
View file @
88068f82
...
@@ -1843,7 +1843,21 @@ test("window resize", function() {
...
@@ -1843,7 +1843,21 @@ test("window resize", function() {
ok
(
!
jQuery
(
window
).
data
(
"__events__"
),
"Make sure all the events are gone."
);
ok
(
!
jQuery
(
window
).
data
(
"__events__"
),
"Make sure all the events are gone."
);
});
});
test
(
"focusin bubbles"
,
function
(){
//create an input and focusin on it
var
input
=
jQuery
(
"<input/>"
),
order
=
0
;
input
.
appendTo
(
document
.
body
);
jQuery
(
document
.
body
).
bind
(
"focusin.focusinBubblesTest"
,
function
(){
equals
(
1
,
order
++
,
"focusin on the body second"
)
})
input
.
bind
(
"focusin.focusinBubblesTest"
,
function
(){
equals
(
0
,
order
++
,
"focusin on the element first"
)
})
input
[
0
].
focus
();
input
.
remove
();
jQuery
(
document
.
body
).
unbind
(
"focusin.focusinBubblesTest"
);
})
/*
/*
test("jQuery(function($) {})", function() {
test("jQuery(function($) {})", function() {
stop();
stop();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment