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
d11fcfac
Commit
d11fcfac
authored
Sep 26, 2011
by
Rick Waldron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests to run in IE9
parent
36c82a1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
event.js
test/unit/event.js
+19
-16
No files found.
test/unit/event.js
View file @
d11fcfac
...
@@ -2338,7 +2338,7 @@ test(".on and .off", function() {
...
@@ -2338,7 +2338,7 @@ test(".on and .off", function() {
test
(
"delegated events quickIs"
,
function
()
{
test
(
"delegated events quickIs"
,
function
()
{
expect
(
17
);
expect
(
17
);
var
markup
=
jQuery
(
var
markup
=
jQuery
(
'<div>'
+
'<div>'
+
'<p class="D">'
+
'<p class="D">'
+
'dead<b devo="cool">beat</b>club'
+
'dead<b devo="cool">beat</b>club'
+
...
@@ -2376,7 +2376,7 @@ test("delegated events quickIs", function() {
...
@@ -2376,7 +2376,7 @@ test("delegated events quickIs", function() {
check
(
"p"
,
"p|.D"
);
check
(
"p"
,
"p|.D"
);
check
(
"b"
,
"b|[devo=cool] p|.D"
);
check
(
"b"
,
"b|[devo=cool] p|.D"
);
check
(
"em"
,
"em|em q|#famous em|em q|#famous"
);
check
(
"em"
,
"em|em q|#famous em|em q|#famous"
);
markup
.
find
(
"b"
).
attr
(
"devo"
,
"NO"
);
markup
.
find
(
"b"
).
attr
(
"devo"
,
"NO"
);
check
(
"b"
,
"b|[devo='NO'] p|.D"
);
check
(
"b"
,
"b|[devo='NO'] p|.D"
);
...
@@ -2384,35 +2384,38 @@ test("delegated events quickIs", function() {
...
@@ -2384,35 +2384,38 @@ test("delegated events quickIs", function() {
});
});
test
(
"propHooks extensions"
,
function
()
{
test
(
"propHooks extensions"
,
function
()
{
expect
(
3
);
expect
(
2
);
// IE requires focusable elements to be visible, so append to body
// IE requires focusable elements to be visible, so append to body
var
$fixture
=
jQuery
(
"<input type='text' id='hook-fixture' />"
).
appendTo
(
"body"
);
var
$fixture
=
jQuery
(
"<input type='text' id='hook-fixture' />"
).
appendTo
(
"body"
),
saved
=
jQuery
.
event
.
propHooks
.
click
;
// Ensure the property doesn't exist
// Ensure the property doesn't exist
$fixture
.
bind
(
"
focus
"
,
function
(
event
)
{
$fixture
.
bind
(
"
click
"
,
function
(
event
)
{
ok
(
!
(
"blurrinessLevel"
in
event
),
"event.blurrinessLevel does not exist"
);
ok
(
!
(
"blurrinessLevel"
in
event
),
"event.blurrinessLevel does not exist"
);
})[
0
].
focus
();
})[
0
].
click
();
// Must blur the link so click works below
$fixture
.
unbind
(
"click"
)[
0
].
blur
();
// Define a custom property for "click" events via the filter function
//ok( !jQuery.event.propHooks.click, "We aren't clobbering an existing click hook" );
// Must blur the link so focus works below
$fixture
.
unbind
(
"focus"
)[
0
].
blur
();
// Define a custom property for "focus" events via the filter function
jQuery
.
event
.
propHooks
.
click
=
{
ok
(
!
jQuery
.
event
.
propHooks
.
focus
,
"We aren't clobbering an existing focus hook"
);
jQuery
.
event
.
propHooks
.
focus
=
{
filter
:
function
(
event
,
originalEvent
)
{
filter
:
function
(
event
,
originalEvent
)
{
event
.
blurrinessLevel
=
42
;
event
.
blurrinessLevel
=
42
;
return
event
;
return
event
;
}
}
};
};
// Trigger a native
focus
and ensure the property is set
// Trigger a native
click
and ensure the property is set
$fixture
.
bind
(
"
focus
"
,
function
(
event
)
{
$fixture
.
bind
(
"
click
"
,
function
(
event
)
{
equals
(
event
.
blurrinessLevel
,
42
,
"event.blurrinessLevel was set"
);
equals
(
event
.
blurrinessLevel
,
42
,
"event.blurrinessLevel was set"
);
})[
0
].
focus
();
})[
0
].
click
();
delete
jQuery
.
event
.
propHooks
.
focus
;
delete
jQuery
.
event
.
propHooks
.
click
;
$fixture
.
unbind
(
"
focus
"
).
remove
();
$fixture
.
unbind
(
"
click
"
).
remove
();
});
});
(
function
(){
(
function
(){
...
...
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