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
6b1b0a26
Commit
6b1b0a26
authored
Jan 16, 2013
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #13233: re-allow .replaceWith of text nodes. Close gh-1137.
parent
13468aba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
manipulation.js
src/manipulation.js
+2
-8
manipulation.js
test/unit/manipulation.js
+5
-1
No files found.
src/manipulation.js
View file @
6b1b0a26
...
...
@@ -269,15 +269,9 @@ jQuery.fn.extend({
var
next
=
this
.
nextSibling
,
parent
=
this
.
parentNode
;
if
(
parent
&&
this
.
nodeType
===
1
||
this
.
nodeType
===
11
)
{
if
(
parent
)
{
jQuery
(
this
).
remove
();
if
(
next
)
{
next
.
parentNode
.
insertBefore
(
elem
,
next
);
}
else
{
parent
.
appendChild
(
elem
);
}
parent
.
insertBefore
(
elem
,
next
);
}
});
},
...
...
test/unit/manipulation.js
View file @
6b1b0a26
...
...
@@ -1149,7 +1149,7 @@ test( "insertAfter(String|Element|Array<Element>|jQuery)", function() {
var
testReplaceWith
=
function
(
val
)
{
var
tmp
,
y
,
child
,
child2
,
set
,
non_existent
,
$div
,
expected
=
2
2
;
expected
=
2
3
;
expect
(
expected
);
...
...
@@ -1176,6 +1176,10 @@ var testReplaceWith = function( val ) {
ok
(
jQuery
(
"#mark"
)[
0
],
"Replace element with set of elements"
);
ok
(
!
jQuery
(
"#groups"
)[
0
],
"Verify that original element is gone, after set of elements"
);
tmp
=
jQuery
(
"<b>content</b>"
)[
0
];
jQuery
(
"#anchor1"
).
contents
().
replaceWith
(
val
(
tmp
)
);
deepEqual
(
jQuery
(
"#anchor1"
).
contents
().
get
(),
[
tmp
],
"Replace text node with element"
);
tmp
=
jQuery
(
"<div/>"
).
appendTo
(
"#qunit-fixture"
).
click
(
function
()
{
ok
(
true
,
"Newly bound click run."
);
...
...
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