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
a619cb30
Commit
a619cb30
authored
Feb 22, 2012
by
Richard Gibson
Committed by
Dave Methvin
Feb 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #11370: .siblings() shouldn't throw exception on a detached element
parent
7226cf28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
traversing.js
src/traversing.js
+1
-1
traversing.js
test/unit/traversing.js
+2
-1
No files found.
src/traversing.js
View file @
a619cb30
...
@@ -204,7 +204,7 @@ jQuery.each({
...
@@ -204,7 +204,7 @@ jQuery.each({
return
jQuery
.
dir
(
elem
,
"previousSibling"
,
until
);
return
jQuery
.
dir
(
elem
,
"previousSibling"
,
until
);
},
},
siblings
:
function
(
elem
)
{
siblings
:
function
(
elem
)
{
return
jQuery
.
sibling
(
elem
.
parentNode
.
firstChild
,
elem
);
return
jQuery
.
sibling
(
(
elem
.
parentNode
||
{}
)
.
firstChild
,
elem
);
},
},
children
:
function
(
elem
)
{
children
:
function
(
elem
)
{
return
jQuery
.
sibling
(
elem
.
firstChild
);
return
jQuery
.
sibling
(
elem
.
firstChild
);
...
...
test/unit/traversing.js
View file @
a619cb30
...
@@ -414,7 +414,7 @@ test("andSelf()", function() {
...
@@ -414,7 +414,7 @@ test("andSelf()", function() {
});
});
test
(
"siblings([String])"
,
function
()
{
test
(
"siblings([String])"
,
function
()
{
expect
(
6
);
expect
(
7
);
deepEqual
(
jQuery
(
"#en"
).
siblings
().
get
(),
q
(
"sndp"
,
"sap"
),
"Check for siblings"
);
deepEqual
(
jQuery
(
"#en"
).
siblings
().
get
(),
q
(
"sndp"
,
"sap"
),
"Check for siblings"
);
deepEqual
(
jQuery
(
"#sndp"
).
siblings
(
":has(code)"
).
get
(),
q
(
"sap"
),
"Check for filtered siblings (has code child element)"
);
deepEqual
(
jQuery
(
"#sndp"
).
siblings
(
":has(code)"
).
get
(),
q
(
"sap"
),
"Check for filtered siblings (has code child element)"
);
deepEqual
(
jQuery
(
"#sndp"
).
siblings
(
":has(a)"
).
get
(),
q
(
"en"
,
"sap"
),
"Check for filtered siblings (has anchor child element)"
);
deepEqual
(
jQuery
(
"#sndp"
).
siblings
(
":has(a)"
).
get
(),
q
(
"en"
,
"sap"
),
"Check for filtered siblings (has anchor child element)"
);
...
@@ -422,6 +422,7 @@ test("siblings([String])", function() {
...
@@ -422,6 +422,7 @@ test("siblings([String])", function() {
var
set
=
q
(
"sndp"
,
"en"
,
"sap"
);
var
set
=
q
(
"sndp"
,
"en"
,
"sap"
);
deepEqual
(
jQuery
(
"#en, #sndp"
).
siblings
().
get
(),
set
,
"Check for unique results from siblings"
);
deepEqual
(
jQuery
(
"#en, #sndp"
).
siblings
().
get
(),
set
,
"Check for unique results from siblings"
);
deepEqual
(
jQuery
(
"#option5a"
).
siblings
(
"option[data-attr]"
).
get
(),
q
(
"option5c"
),
"Has attribute selector in siblings (#9261)"
);
deepEqual
(
jQuery
(
"#option5a"
).
siblings
(
"option[data-attr]"
).
get
(),
q
(
"option5c"
),
"Has attribute selector in siblings (#9261)"
);
equal
(
jQuery
(
"<a/>"
).
siblings
().
length
,
0
,
"Detached elements have no siblings (#11370)"
);
});
});
test
(
"children([String])"
,
function
()
{
test
(
"children([String])"
,
function
()
{
...
...
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