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
c746f79c
Commit
c746f79c
authored
Jan 28, 2012
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #10878. Clear oldIE special change/submit flags on a clone.
parent
633ca9c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
manipulation.js
src/manipulation.js
+5
-0
delegatetest.html
test/delegatetest.html
+12
-2
No files found.
src/manipulation.js
View file @
c746f79c
...
@@ -461,6 +461,11 @@ function cloneFixAttributes( src, dest ) {
...
@@ -461,6 +461,11 @@ 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
(
"_submit_attached"
);
dest
.
removeAttribute
(
"_change_attached"
);
}
}
jQuery
.
buildFragment
=
function
(
args
,
nodes
,
scripts
)
{
jQuery
.
buildFragment
=
function
(
args
,
nodes
,
scripts
)
{
...
...
test/delegatetest.html
View file @
c746f79c
...
@@ -143,7 +143,7 @@ $(function(){
...
@@ -143,7 +143,7 @@ $(function(){
});
});
// Events we want to track in row-order
// Events we want to track in row-order
var
events
=
"bind-change live-change on-change bind-propertychange live-beforeactivate live-focusin bind-focus live-beforedeactivate live-focusout bind-blur live-click live-keydown"
.
split
(
" "
),
var
events
=
"bind-change live-change on
X
-change bind-propertychange live-beforeactivate live-focusin bind-focus live-beforedeactivate live-focusout bind-blur live-click live-keydown"
.
split
(
" "
),
counter
=
0
;
counter
=
0
;
blinker
=
function
(
event
){
blinker
=
function
(
event
){
if
(
!
counter
)
{
if
(
!
counter
)
{
...
@@ -172,7 +172,7 @@ for ( var i=0; i < events.length; i++ ) {
...
@@ -172,7 +172,7 @@ for ( var i=0; i < events.length; i++ ) {
$
(
"#changes thead td"
).
each
(
function
(){
$
(
"#changes thead td"
).
each
(
function
(){
var
id
=
"#"
+
this
.
id
,
var
id
=
"#"
+
this
.
id
,
$cell
=
$
(
'<td></td>'
);
$cell
=
$
(
'<td></td>'
);
if
(
api
==
"on"
)
{
if
(
api
==
"on
X
"
)
{
$
(
this
).
find
(
"input, button, select, textarea"
).
each
(
function
(){
$
(
this
).
find
(
"input, button, select, textarea"
).
each
(
function
(){
this
[
"on"
+
type
]
=
function
(
e
){
e
=
$
.
event
.
fix
(
e
||
event
);
e
.
data
=
$cell
;
blinker
.
call
(
this
,
e
);
};
this
[
"on"
+
type
]
=
function
(
e
){
e
=
$
.
event
.
fix
(
e
||
event
);
e
.
data
=
$cell
;
blinker
.
call
(
this
,
e
);
};
});
});
...
@@ -186,6 +186,16 @@ for ( var i=0; i < events.length; i++ ) {
...
@@ -186,6 +186,16 @@ for ( var i=0; i < events.length; i++ ) {
$
(
"#changes tbody"
).
append
(
$row
);
$
(
"#changes tbody"
).
append
(
$row
);
}
}
// Ensure that cloned elements get the delegated event magic; this is
// implementation-specific knowledge but otherwise impossible to test.
// The beforeactivate event attaches a direct-bound change event.
// (Only care about the live change for this third select element.)
var
sel1
=
$
(
"#select-one select:first-child"
);
if
(
typeof
(
sel1
[
0
].
fireEvent
)
!==
"undefined"
)
{
sel1
.
trigger
(
"beforeactivate"
).
clone
().
appendTo
(
"#select-one"
);
//alert($("#select-one select").map(function(){ return this._change_attached || "undef"; }).get().join("|"));
}
jQuery
.
fn
.
blink
=
function
(){
jQuery
.
fn
.
blink
=
function
(){
return
this
return
this
.
css
(
"backgroundColor"
,
"green"
)
.
css
(
"backgroundColor"
,
"green"
)
...
...
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