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
569d064f
Commit
569d064f
authored
Jul 25, 2012
by
Daniel Chatfield
Committed by
Dave Methvin
Jul 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #12127. IE9/10 checks fall off the box on clone. Close gh-873.
parent
fffd2328
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
6 deletions
+16
-6
AUTHORS.txt
AUTHORS.txt
+1
-0
manipulation.js
src/manipulation.js
+1
-3
support.js
src/support.js
+3
-3
manipulation.js
test/unit/manipulation.js
+11
-0
No files found.
AUTHORS.txt
View file @
569d064f
...
@@ -129,3 +129,4 @@ David Benjamin <davidben@mit.edu>
...
@@ -129,3 +129,4 @@ David Benjamin <davidben@mit.edu>
Uri Gilad <antishok@gmail.com>
Uri Gilad <antishok@gmail.com>
Chris Faulkner <thefaulkner@gmail.com>
Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com>
Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@googlemail.com>
src/manipulation.js
View file @
569d064f
...
@@ -455,9 +455,7 @@ function cloneFixAttributes( src, dest ) {
...
@@ -455,9 +455,7 @@ function cloneFixAttributes( src, dest ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
// a checked appearance if the defaultChecked value isn't also set
if
(
src
.
checked
)
{
dest
.
defaultChecked
=
dest
.
checked
=
src
.
checked
;
dest
.
defaultChecked
=
dest
.
checked
=
src
.
checked
;
}
// IE6-7 get confused and end up setting the value of a cloned
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
// checkbox/radio button to an empty string instead of "on"
...
...
src/support.js
View file @
569d064f
...
@@ -15,7 +15,7 @@ jQuery.support = (function() {
...
@@ -15,7 +15,7 @@ jQuery.support = (function() {
// Preliminary tests
// Preliminary tests
div
.
setAttribute
(
"className"
,
"t"
);
div
.
setAttribute
(
"className"
,
"t"
);
div
.
innerHTML
=
" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"
;
div
.
innerHTML
=
" <link/><table></table><a href='/a'>a</a><input type='checkbox'
checked='checked'
/>"
;
all
=
div
.
getElementsByTagName
(
"*"
);
all
=
div
.
getElementsByTagName
(
"*"
);
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
...
@@ -96,8 +96,8 @@ jQuery.support = (function() {
...
@@ -96,8 +96,8 @@ jQuery.support = (function() {
};
};
// Make sure checked status is properly cloned
// Make sure checked status is properly cloned
input
.
checked
=
tru
e
;
input
.
checked
=
fals
e
;
support
.
noCloneChecked
=
input
.
cloneNode
(
true
).
checked
;
support
.
noCloneChecked
=
!
input
.
cloneNode
(
true
).
checked
;
// Make sure that the options inside disabled selects aren't marked as disabled
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
// (WebKit marks them as disabled)
...
...
test/unit/manipulation.js
View file @
569d064f
...
@@ -1895,3 +1895,14 @@ test("html() - script exceptions bubble (#11743)", function() {
...
@@ -1895,3 +1895,14 @@ test("html() - script exceptions bubble (#11743)", function() {
ok
(
false
,
"error ignored"
);
ok
(
false
,
"error ignored"
);
},
"exception bubbled from remote script"
);
},
"exception bubbled from remote script"
);
});
});
test
(
"checked state is cloned with clone()"
,
function
(){
expect
(
2
);
var
elem
=
jQuery
.
parseHTML
(
'<input type="checkbox" checked="checked"/>'
)[
0
];
elem
.
checked
=
false
;
equal
(
jQuery
(
elem
).
clone
().
attr
(
'id'
,
'clone'
)[
0
].
checked
,
false
,
'Checked false state correctly cloned'
);
elem
=
jQuery
.
parseHTML
(
'<input type="checkbox"/>'
)[
0
];
elem
.
checked
=
true
;
equal
(
jQuery
(
elem
).
clone
().
attr
(
'id'
,
'clone'
)[
0
].
checked
,
true
,
'Checked true state correctly cloned'
);
});
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