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
47578817
Commit
47578817
authored
May 21, 2012
by
Jason Moon
Committed by
Dave Methvin
May 23, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #11796. Preserve oldIE change delegation on clone. Closes gh-789.
parent
b5a84a48
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
6 deletions
+34
-6
event.js
src/event.js
+2
-2
manipulation.js
src/manipulation.js
+0
-4
event.js
test/unit/event.js
+32
-0
No files found.
src/event.js
View file @
47578817
...
@@ -835,13 +835,13 @@ if ( !jQuery.support.changeBubbles ) {
...
@@ -835,13 +835,13 @@ if ( !jQuery.support.changeBubbles ) {
jQuery
.
event
.
add
(
this
,
"beforeactivate._change"
,
function
(
e
)
{
jQuery
.
event
.
add
(
this
,
"beforeactivate._change"
,
function
(
e
)
{
var
elem
=
e
.
target
;
var
elem
=
e
.
target
;
if
(
rformElems
.
test
(
elem
.
nodeName
)
&&
!
elem
.
_change_attached
)
{
if
(
rformElems
.
test
(
elem
.
nodeName
)
&&
!
jQuery
.
_data
(
elem
,
"_change_attached"
)
)
{
jQuery
.
event
.
add
(
elem
,
"change._change"
,
function
(
event
)
{
jQuery
.
event
.
add
(
elem
,
"change._change"
,
function
(
event
)
{
if
(
this
.
parentNode
&&
!
event
.
isSimulated
&&
!
event
.
isTrigger
)
{
if
(
this
.
parentNode
&&
!
event
.
isSimulated
&&
!
event
.
isTrigger
)
{
jQuery
.
event
.
simulate
(
"change"
,
this
.
parentNode
,
event
,
true
);
jQuery
.
event
.
simulate
(
"change"
,
this
.
parentNode
,
event
,
true
);
}
}
});
});
elem
.
_change_attached
=
true
;
jQuery
.
_data
(
elem
,
"_change_attached"
,
true
)
;
}
}
});
});
},
},
...
...
src/manipulation.js
View file @
47578817
...
@@ -464,10 +464,6 @@ function cloneFixAttributes( src, dest ) {
...
@@ -464,10 +464,6 @@ function cloneFixAttributes( src, dest ) {
// Event data gets referenced instead of copied if the expando
// Event data gets referenced instead of copied if the expando
// gets copied too
// gets copied too
dest
.
removeAttribute
(
jQuery
.
expando
);
dest
.
removeAttribute
(
jQuery
.
expando
);
// Clear flags for bubbling special change/submit events, they must
// be reattached when the newly cloned events are first activated
dest
.
removeAttribute
(
"_change_attached"
);
}
}
jQuery
.
buildFragment
=
function
(
args
,
context
,
scripts
)
{
jQuery
.
buildFragment
=
function
(
args
,
context
,
scripts
)
{
...
...
test/unit/event.js
View file @
47578817
...
@@ -1098,6 +1098,38 @@ test( "submit event bubbles on copied forms (#11649)", function(){
...
@@ -1098,6 +1098,38 @@ test( "submit event bubbles on copied forms (#11649)", function(){
$testForm
.
off
(
"submit"
,
noSubmit
);
$testForm
.
off
(
"submit"
,
noSubmit
);
});
});
test
(
"change event bubbles on copied forms (#11796)"
,
function
(){
expect
(
3
);
var
$formByClone
,
$formByHTML
,
$form
=
jQuery
(
"#form"
),
$fixture
=
jQuery
(
"#qunit-fixture"
),
$wrapperDiv
=
jQuery
(
"<div/>"
).
appendTo
(
$fixture
);
function
delegatedChange
()
{
ok
(
true
,
"Make sure change event bubbles up."
);
return
false
;
}
// Attach a delegated change handler to the form
$fixture
.
on
(
"change"
,
"form"
,
delegatedChange
);
// Trigger change event to introduce the _change_attached property
$form
.
find
(
"select[name=select1]"
).
val
(
"1"
).
change
();
// Copy the form via .clone() and .html()
$formByClone
=
$form
.
clone
(
true
,
true
).
removeAttr
(
"id"
);
$formByHTML
=
jQuery
(
$fixture
.
html
()
).
filter
(
"#form"
).
removeAttr
(
"id"
);
$wrapperDiv
.
append
(
$formByClone
,
$formByHTML
);
// Check change bubbling on the copied forms
$wrapperDiv
.
find
(
"form select[name=select1]"
).
val
(
"2"
).
change
();
// Clean up
$wrapperDiv
.
remove
();
$fixture
.
off
(
"change"
,
"form"
,
delegatedChange
);
});
test
(
"trigger(eventObject, [data], [fn])"
,
function
()
{
test
(
"trigger(eventObject, [data], [fn])"
,
function
()
{
expect
(
28
);
expect
(
28
);
...
...
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