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
c9528311
Commit
c9528311
authored
Nov 21, 2006
by
Jörn Zaefferer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced all x.constructor == String comparsions with typeof x == "string"
parent
ae58d24f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
jquery.js
src/jquery/jquery.js
+7
-9
No files found.
src/jquery/jquery.js
View file @
c9528311
...
...
@@ -42,7 +42,7 @@ var jQuery = function(a,c) {
return
new
jQuery
(
a
,
c
);
// Handle HTML strings
if
(
a
.
constructor
==
String
)
{
if
(
typeof
a
==
"string"
)
{
var
m
=
/^
[^
<
]
*
(
<.+>
)[^
>
]
*$/
.
exec
(
a
);
if
(
m
)
a
=
jQuery
.
clean
(
[
m
[
1
]
]
);
}
...
...
@@ -904,7 +904,7 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing
*/
not
:
function
(
t
)
{
return
this
.
pushStack
(
t
.
constructor
==
String
?
return
this
.
pushStack
(
t
ypeof
t
==
"string"
?
jQuery
.
filter
(
t
,
this
,
false
).
r
:
jQuery
.
grep
(
this
,
function
(
a
){
return
a
!=
t
;
}),
arguments
);
},
...
...
@@ -951,7 +951,7 @@ jQuery.fn = jQuery.prototype = {
* @cat DOM/Traversing
*/
add
:
function
(
t
)
{
return
this
.
pushStack
(
jQuery
.
merge
(
this
,
t
.
constructor
==
String
?
return
this
.
pushStack
(
jQuery
.
merge
(
this
,
t
ypeof
t
==
"string"
?
jQuery
.
find
(
t
)
:
t
.
constructor
==
Array
?
t
:
[
t
]
),
arguments
);
},
...
...
@@ -1121,7 +1121,7 @@ jQuery.extend({
jQuery
.
each
(
jQuery
.
macros
.
axis
,
function
(
i
,
n
){
jQuery
.
fn
[
i
]
=
function
(
a
)
{
var
ret
=
jQuery
.
map
(
this
,
n
);
if
(
a
&&
a
.
constructor
==
String
)
if
(
a
&&
typeof
a
==
"string"
)
ret
=
jQuery
.
filter
(
a
,
ret
).
r
;
return
this
.
pushStack
(
ret
,
arguments
);
};
...
...
@@ -1324,7 +1324,7 @@ jQuery.extend({
var
r
=
[];
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
{
var
arg
=
a
[
i
];
if
(
arg
.
constructor
==
String
)
{
// Convert html string into DOM nodes
if
(
typeof
arg
==
"string"
)
{
// Convert html string into DOM nodes
// Trim whitespace, otherwise indexOf won't work as expected
var
s
=
jQuery
.
trim
(
arg
),
div
=
document
.
createElement
(
"div"
),
wrap
=
[
0
,
""
,
""
];
...
...
@@ -1777,7 +1777,7 @@ jQuery.extend({
grep
:
function
(
elems
,
fn
,
inv
)
{
// If a string is passed in for the function, make a function
// for it (a handy shortcut)
if
(
fn
.
constructor
==
String
)
if
(
typeof
fn
==
"string"
)
fn
=
new
Function
(
"a"
,
"i"
,
"return "
+
fn
);
var
result
=
[];
...
...
@@ -1823,7 +1823,7 @@ jQuery.extend({
map
:
function
(
elems
,
fn
)
{
// If a string is passed in for the function, make a function
// for it (a handy shortcut)
if
(
fn
.
constructor
==
String
)
if
(
typeof
fn
==
"string"
)
fn
=
new
Function
(
"a"
,
"return "
+
fn
);
var
result
=
[];
...
...
@@ -3010,8 +3010,6 @@ jQuery.macros = {
* @cat Events
*/
bind
:
function
(
type
,
fn
)
{
if
(
fn
.
constructor
==
String
)
fn
=
new
Function
(
"e"
,
(
!
fn
.
indexOf
(
"."
)
?
"jQuery(this)"
:
"return "
)
+
fn
);
jQuery
.
event
.
add
(
this
,
type
,
fn
);
},
...
...
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