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
fa4c9098
Commit
fa4c9098
authored
Feb 01, 2011
by
rwldrn
Committed by
Anton M
Feb 01, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #8129. Fix cloning multiple selected options in IE8.
parent
cb85da7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
manipulation.js
src/manipulation.js
+2
-2
manipulation.js
test/unit/manipulation.js
+9
-1
No files found.
src/manipulation.js
View file @
fa4c9098
...
@@ -503,6 +503,8 @@ jQuery.extend({
...
@@ -503,6 +503,8 @@ jQuery.extend({
// proprietary methods to clear the events. Thanks to MooTools
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
// guys for this hotness.
cloneFixAttributes
(
elem
,
clone
);
// Using Sizzle here is crazy slow, so we use getElementsByTagName
// Using Sizzle here is crazy slow, so we use getElementsByTagName
// instead
// instead
srcElements
=
elem
.
getElementsByTagName
(
"*"
);
srcElements
=
elem
.
getElementsByTagName
(
"*"
);
...
@@ -514,8 +516,6 @@ jQuery.extend({
...
@@ -514,8 +516,6 @@ jQuery.extend({
for
(
i
=
0
;
srcElements
[
i
];
++
i
)
{
for
(
i
=
0
;
srcElements
[
i
];
++
i
)
{
cloneFixAttributes
(
srcElements
[
i
],
destElements
[
i
]
);
cloneFixAttributes
(
srcElements
[
i
],
destElements
[
i
]
);
}
}
cloneFixAttributes
(
elem
,
clone
);
}
}
// Copy the events from the original to the clone
// Copy the events from the original to the clone
...
...
test/unit/manipulation.js
View file @
fa4c9098
...
@@ -1006,7 +1006,7 @@ test("clone()", function() {
...
@@ -1006,7 +1006,7 @@ test("clone()", function() {
test
(
"clone(form element) (Bug #3879, #6655)"
,
function
()
{
test
(
"clone(form element) (Bug #3879, #6655)"
,
function
()
{
expect
(
6
);
expect
(
6
);
element
=
jQuery
(
"<select><option>Foo</option><option selected>Bar</option></select>"
);
var
element
=
jQuery
(
"<select><option>Foo</option><option selected>Bar</option></select>"
);
equals
(
element
.
clone
().
find
(
"option:selected"
).
val
(),
element
.
find
(
"option:selected"
).
val
(),
"Selected option cloned correctly"
);
equals
(
element
.
clone
().
find
(
"option:selected"
).
val
(),
element
.
find
(
"option:selected"
).
val
(),
"Selected option cloned correctly"
);
...
@@ -1026,6 +1026,14 @@ test("clone(form element) (Bug #3879, #6655)", function() {
...
@@ -1026,6 +1026,14 @@ test("clone(form element) (Bug #3879, #6655)", function() {
equals
(
clone
[
0
].
defaultValue
,
"foo"
,
"Textarea defaultValue cloned correctly"
);
equals
(
clone
[
0
].
defaultValue
,
"foo"
,
"Textarea defaultValue cloned correctly"
);
});
});
test
(
"clone(multiple selected options) (Bug #8129)"
,
function
()
{
expect
(
1
);
var
element
=
jQuery
(
"<select><option>Foo</option><option selected>Bar</option><option selected>Baz</option></select>"
);
equals
(
element
.
clone
().
find
(
"option:selected"
).
length
,
element
.
find
(
"option:selected"
).
length
,
"Multiple selected options cloned correctly"
);
});
if
(
!
isLocal
)
{
if
(
!
isLocal
)
{
test
(
"clone() on XML nodes"
,
function
()
{
test
(
"clone() on XML nodes"
,
function
()
{
expect
(
2
);
expect
(
2
);
...
...
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