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
07392bb0
Commit
07392bb0
authored
Mar 22, 2011
by
Carl Fürstenberg
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into makefile_fixes
parents
51abb3dc
7705c35b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
17 deletions
+80
-17
Makefile
Makefile
+17
-7
event.js
src/event.js
+24
-10
event.js
test/unit/event.js
+39
-0
No files found.
Makefile
View file @
07392bb0
...
@@ -42,17 +42,15 @@ VER = sed "s/@VERSION/${JQ_VER}/"
...
@@ -42,17 +42,15 @@ VER = sed "s/@VERSION/${JQ_VER}/"
DATE
=
$(
shell
git log
-1
--pretty
=
format:%ad
)
DATE
=
$(
shell
git log
-1
--pretty
=
format:%ad
)
all
:
jquery min lint
all
:
update_submodules core
core
:
jquery min lint
@
@echo
"jQuery build complete."
@
@echo
"jQuery build complete."
${DIST_DIR}
:
${DIST_DIR}
:
@
@mkdir
-p
${
DIST_DIR
}
@
@mkdir
-p
${
DIST_DIR
}
init
:
jquery
:
${JQ}
@
@if
[
-d
.git
]
;
then
git submodule update
--init
--recursive
;
fi
jquery
:
init ${JQ}
jq
:
init ${JQ}
${JQ}
:
${MODULES} | ${DIST_DIR}
${JQ}
:
${MODULES} | ${DIST_DIR}
@
@echo
"Building"
${
JQ
}
@
@echo
"Building"
${
JQ
}
...
@@ -99,6 +97,18 @@ distclean: clean
...
@@ -99,6 +97,18 @@ distclean: clean
@
@echo
"Removing submodules"
@
@echo
"Removing submodules"
@
@rm
-rf
test
/qunit src/sizzle
@
@rm
-rf
test
/qunit src/sizzle
# change pointers for submodules and update them to what is specified in jQuery
# --merge doesn't work when doing an initial clone, thus test if we have non-existing
# submodules, then do an real update
update_submodules
:
@
@if
[
-d
.git
]
;
then
\
if
git submodule status |
grep
-q
-E
'^-'
;
then
\
git submodule update
--init
--recursive
;
\
else
\
git submodule update
--init
--recursive
--merge
;
\
fi
;
\
fi
;
# update the submodules to the latest at the most logical branch
# update the submodules to the latest at the most logical branch
pull_submodules
:
pull_submodules
:
@
@git submodule foreach
"git pull origin
\$
$
(git branch --no-color --contains
\$
$
(git rev-parse HEAD) | grep -v
\(
| head -1)"
@
@git submodule foreach
"git pull origin
\$
$
(git branch --no-color --contains
\$
$
(git rev-parse HEAD) | grep -v
\(
| head -1)"
...
@@ -107,4 +117,4 @@ pull_submodules:
...
@@ -107,4 +117,4 @@ pull_submodules:
pull
:
pull_submodules
pull
:
pull_submodules
@
@git pull
${
REMOTE
}
${
BRANCH
}
@
@git pull
${
REMOTE
}
${
BRANCH
}
.PHONY
:
all jquery lint min
init jq clean
.PHONY
:
all jquery lint min
clean distclean update_submodules pull_submodules pull core
src/event.js
View file @
07392bb0
...
@@ -70,10 +70,10 @@ jQuery.event = {
...
@@ -70,10 +70,10 @@ jQuery.event = {
}
}
if
(
!
eventHandle
)
{
if
(
!
eventHandle
)
{
elemData
.
handle
=
eventHandle
=
function
()
{
elemData
.
handle
=
eventHandle
=
function
(
e
)
{
// Handle the second event of a trigger and when
// Handle the second event of a trigger and when
// an event is called after a page has unloaded
// an event is called after a page has unloaded
return
typeof
jQuery
!==
"undefined"
&&
!
jQuery
.
event
.
triggered
?
return
typeof
jQuery
!==
"undefined"
&&
jQuery
.
event
.
triggered
!==
e
.
type
?
jQuery
.
event
.
handle
.
apply
(
eventHandle
.
elem
,
arguments
)
:
jQuery
.
event
.
handle
.
apply
(
eventHandle
.
elem
,
arguments
)
:
undefined
;
undefined
;
};
};
...
@@ -380,7 +380,7 @@ jQuery.event = {
...
@@ -380,7 +380,7 @@ jQuery.event = {
target
[
"on"
+
targetType
]
=
null
;
target
[
"on"
+
targetType
]
=
null
;
}
}
jQuery
.
event
.
triggered
=
tru
e
;
jQuery
.
event
.
triggered
=
event
.
typ
e
;
target
[
targetType
]();
target
[
targetType
]();
}
}
...
@@ -391,7 +391,7 @@ jQuery.event = {
...
@@ -391,7 +391,7 @@ jQuery.event = {
target
[
"on"
+
targetType
]
=
old
;
target
[
"on"
+
targetType
]
=
old
;
}
}
jQuery
.
event
.
triggered
=
false
;
jQuery
.
event
.
triggered
=
undefined
;
}
}
}
}
},
},
...
@@ -661,7 +661,7 @@ var withinElement = function( event ) {
...
@@ -661,7 +661,7 @@ var withinElement = function( event ) {
// Chrome does something similar, the parentNode property
// Chrome does something similar, the parentNode property
// can be accessed but is null.
// can be accessed but is null.
if
(
parent
!==
document
&&
!
parent
.
parentNode
)
{
if
(
parent
&&
parent
!==
document
&&
!
parent
.
parentNode
)
{
return
;
return
;
}
}
// Traverse up the tree
// Traverse up the tree
...
@@ -868,19 +868,33 @@ function trigger( type, elem, args ) {
...
@@ -868,19 +868,33 @@ function trigger( type, elem, args ) {
// Create "bubbling" focus and blur events
// Create "bubbling" focus and blur events
if
(
document
.
addEventListener
)
{
if
(
document
.
addEventListener
)
{
jQuery
.
each
({
focus
:
"focusin"
,
blur
:
"focusout"
},
function
(
orig
,
fix
)
{
jQuery
.
each
({
focus
:
"focusin"
,
blur
:
"focusout"
},
function
(
orig
,
fix
)
{
// Attach a single capturing handler while someone wants focusin/focusout
var
attaches
=
0
;
jQuery
.
event
.
special
[
fix
]
=
{
jQuery
.
event
.
special
[
fix
]
=
{
setup
:
function
()
{
setup
:
function
()
{
this
.
addEventListener
(
orig
,
handler
,
true
);
if
(
attaches
++
===
0
)
{
document
.
addEventListener
(
orig
,
handler
,
true
);
}
},
},
teardown
:
function
()
{
teardown
:
function
()
{
this
.
removeEventListener
(
orig
,
handler
,
true
);
if
(
--
attaches
===
0
)
{
document
.
removeEventListener
(
orig
,
handler
,
true
);
}
}
}
};
};
function
handler
(
e
)
{
function
handler
(
donor
)
{
e
=
jQuery
.
event
.
fix
(
e
);
// Donor event is always a native one; fix it and switch its type.
// Let focusin/out handler cancel the donor focus/blur event.
var
e
=
jQuery
.
event
.
fix
(
donor
);
e
.
type
=
fix
;
e
.
type
=
fix
;
return
jQuery
.
event
.
handle
.
call
(
this
,
e
);
e
.
originalEvent
=
{};
jQuery
.
event
.
trigger
(
e
,
null
,
e
.
target
);
if
(
e
.
isDefaultPrevented
()
)
{
donor
.
preventDefault
();
}
}
}
});
});
}
}
...
...
test/unit/event.js
View file @
07392bb0
...
@@ -683,6 +683,20 @@ test("hover()", function() {
...
@@ -683,6 +683,20 @@ test("hover()", function() {
equals
(
times
,
4
,
"hover handlers fired"
);
equals
(
times
,
4
,
"hover handlers fired"
);
});
});
test
(
"mouseover triggers mouseenter"
,
function
()
{
expect
(
1
);
var
count
=
0
,
elem
=
jQuery
(
"<a />"
);
elem
.
mouseenter
(
function
()
{
count
++
;
});
elem
.
trigger
(
'mouseover'
);
equals
(
count
,
1
,
"make sure mouseover triggers a mouseenter"
);
elem
.
remove
();
});
test
(
"trigger() shortcuts"
,
function
()
{
test
(
"trigger() shortcuts"
,
function
()
{
expect
(
6
);
expect
(
6
);
...
@@ -1966,6 +1980,31 @@ test("window resize", function() {
...
@@ -1966,6 +1980,31 @@ test("window resize", function() {
ok
(
!
jQuery
.
_data
(
window
,
"__events__"
),
"Make sure all the events are gone."
);
ok
(
!
jQuery
.
_data
(
window
,
"__events__"
),
"Make sure all the events are gone."
);
});
});
test
(
"focusin bubbles"
,
function
()
{
expect
(
4
);
var
input
=
jQuery
(
'<input type="text" />'
).
prependTo
(
"body"
),
order
=
0
;
jQuery
(
"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"
);
});
// DOM focus method
input
[
0
].
focus
();
// jQuery trigger, which calls DOM focus
order
=
0
;
input
[
0
].
blur
();
input
.
trigger
(
"focus"
);
input
.
remove
();
jQuery
(
"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