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
c916aef8
Commit
c916aef8
authored
May 04, 2015
by
Timmy Willison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Core: allow init to accept an alternate rootjQuery for migrate's sake
- This will be tested in migrate Fixes gh-2101
parent
cf16f860
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
init.js
src/core/init.js
+8
-4
No files found.
src/core/init.js
View file @
c916aef8
...
@@ -17,7 +17,7 @@ var rootjQuery,
...
@@ -17,7 +17,7 @@ var rootjQuery,
// Shortcut simple #id case for speed
// Shortcut simple #id case for speed
rquickExpr
=
/^
(?:\s
*
(
<
[\w\W]
+>
)[^
>
]
*|#
([\w
-
]
+
))
$/
,
rquickExpr
=
/^
(?:\s
*
(
<
[\w\W]
+>
)[^
>
]
*|#
([\w
-
]
+
))
$/
,
init
=
jQuery
.
fn
.
init
=
function
(
selector
,
context
)
{
init
=
jQuery
.
fn
.
init
=
function
(
selector
,
context
,
root
)
{
var
match
,
elem
;
var
match
,
elem
;
// HANDLE: $(""), $(null), $(undefined), $(false)
// HANDLE: $(""), $(null), $(undefined), $(false)
...
@@ -25,6 +25,10 @@ var rootjQuery,
...
@@ -25,6 +25,10 @@ var rootjQuery,
return
this
;
return
this
;
}
}
// init accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101)
root
=
root
||
rootjQuery
;
// Handle HTML strings
// Handle HTML strings
if
(
typeof
selector
===
"string"
)
{
if
(
typeof
selector
===
"string"
)
{
if
(
selector
[
0
]
===
"<"
&&
if
(
selector
[
0
]
===
"<"
&&
...
@@ -83,7 +87,7 @@ var rootjQuery,
...
@@ -83,7 +87,7 @@ var rootjQuery,
// HANDLE: $(expr, $(...))
// HANDLE: $(expr, $(...))
}
else
if
(
!
context
||
context
.
jquery
)
{
}
else
if
(
!
context
||
context
.
jquery
)
{
return
(
context
||
root
jQuery
).
find
(
selector
);
return
(
context
||
root
).
find
(
selector
);
// HANDLE: $(expr, context)
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
// (which is just equivalent to: $(context).find(expr)
...
@@ -100,8 +104,8 @@ var rootjQuery,
...
@@ -100,8 +104,8 @@ var rootjQuery,
// HANDLE: $(function)
// HANDLE: $(function)
// Shortcut for document ready
// Shortcut for document ready
}
else
if
(
jQuery
.
isFunction
(
selector
)
)
{
}
else
if
(
jQuery
.
isFunction
(
selector
)
)
{
return
typeof
root
jQuery
.
ready
!==
"undefined"
?
return
typeof
root
.
ready
!==
"undefined"
?
root
jQuery
.
ready
(
selector
)
:
root
.
ready
(
selector
)
:
// Execute immediately if ready is not present
// Execute immediately if ready is not present
selector
(
jQuery
);
selector
(
jQuery
);
}
}
...
...
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