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
c6f189ac
Commit
c6f189ac
authored
Jan 08, 2009
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Selector state wasn't being passed along on a cloned jQuery object.
parent
49d0d5b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
core.js
src/core.js
+6
-0
core.js
test/unit/core.js
+6
-1
No files found.
src/core.js
View file @
c6f189ac
...
@@ -73,6 +73,12 @@ jQuery.fn = jQuery.prototype = {
...
@@ -73,6 +73,12 @@ jQuery.fn = jQuery.prototype = {
}
else
if
(
jQuery
.
isFunction
(
selector
)
)
}
else
if
(
jQuery
.
isFunction
(
selector
)
)
return
jQuery
(
document
).
ready
(
selector
);
return
jQuery
(
document
).
ready
(
selector
);
// Make sure that old selector state is passed along
if
(
selector
.
selector
&&
selector
.
context
)
{
this
.
selector
=
selector
.
selector
;
this
.
context
=
selector
.
context
;
}
return
this
.
setArray
(
jQuery
.
makeArray
(
selector
));
return
this
.
setArray
(
jQuery
.
makeArray
(
selector
));
},
},
...
...
test/unit/core.js
View file @
c6f189ac
...
@@ -53,7 +53,7 @@ test("jQuery()", function() {
...
@@ -53,7 +53,7 @@ test("jQuery()", function() {
});
});
test
(
"selector state"
,
function
()
{
test
(
"selector state"
,
function
()
{
expect
(
2
6
);
expect
(
2
8
);
var
test
;
var
test
;
...
@@ -80,6 +80,11 @@ test("selector state", function() {
...
@@ -80,6 +80,11 @@ test("selector state", function() {
test
=
jQuery
(
"#main"
,
document
.
body
);
test
=
jQuery
(
"#main"
,
document
.
body
);
equals
(
test
.
selector
,
"#main"
,
"#main Selector"
);
equals
(
test
.
selector
,
"#main"
,
"#main Selector"
);
equals
(
test
.
context
,
document
.
body
,
"#main Context"
);
equals
(
test
.
context
,
document
.
body
,
"#main Context"
);
// Test cloning
test
=
jQuery
(
test
);
equals
(
test
.
selector
,
"#main"
,
"#main Selector"
);
equals
(
test
.
context
,
document
.
body
,
"#main Context"
);
test
=
jQuery
(
document
.
body
).
find
(
"#main"
);
test
=
jQuery
(
document
.
body
).
find
(
"#main"
);
equals
(
test
.
selector
,
"#main"
,
"#main find Selector"
);
equals
(
test
.
selector
,
"#main"
,
"#main find Selector"
);
...
...
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