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
69d9abff
Commit
69d9abff
authored
May 06, 2008
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery core: removing needless 'else' and 'new' in $.fn.init.
parent
46931d31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
13 deletions
+8
-13
core.js
src/core.js
+8
-13
No files found.
src/core.js
View file @
69d9abff
...
...
@@ -36,9 +36,9 @@ jQuery.fn = jQuery.prototype = {
this
[
0
]
=
selector
;
this
.
length
=
1
;
return
this
;
}
// Handle HTML strings
}
else
if
(
typeof
selector
==
"string"
)
{
if
(
typeof
selector
==
"string"
)
{
// Are we dealing with HTML string or an ID?
var
match
=
quickExpr
.
exec
(
selector
);
...
...
@@ -54,32 +54,27 @@ jQuery.fn = jQuery.prototype = {
var
elem
=
document
.
getElementById
(
match
[
3
]
);
// Make sure an element was located
if
(
elem
)
if
(
elem
)
{
// Handle the case where IE and Opera return items
// by name instead of ID
if
(
elem
.
id
!=
match
[
3
]
)
return
jQuery
().
find
(
selector
);
// Otherwise, we inject the element directly into the jQuery object
else
{
this
[
0
]
=
elem
;
this
.
length
=
1
;
return
this
;
}
else
selector
=
[];
return
jQuery
(
elem
);
}
selector
=
[];
}
// HANDLE: $(expr, [context])
// (which is just equivalent to: $(content).find(expr)
}
else
return
new
jQuery
(
context
).
find
(
selector
);
return
jQuery
(
context
).
find
(
selector
);
// HANDLE: $(function)
// Shortcut for document ready
}
else
if
(
jQuery
.
isFunction
(
selector
)
)
return
new
jQuery
(
document
)[
jQuery
.
fn
.
ready
?
"ready"
:
"load"
](
selector
);
return
jQuery
(
document
)[
jQuery
.
fn
.
ready
?
"ready"
:
"load"
](
selector
);
return
this
.
setArray
(
jQuery
.
makeArray
(
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