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
86aa764f
Commit
86aa764f
authored
May 02, 2011
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change check for skipping the initial quickExpr RegExp check. Fixes #8984.
parent
f1392d82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
core.js
src/core.js
+3
-2
core.js
test/unit/core.js
+12
-1
No files found.
src/core.js
View file @
86aa764f
...
...
@@ -96,9 +96,10 @@ jQuery.fn = jQuery.prototype = {
// Handle HTML strings
if
(
typeof
selector
===
"string"
)
{
// Are we dealing with HTML string or an ID?
if
(
selector
.
length
>
1024
)
{
// Assume
very large strings
are HTML and skip the regex check
if
(
selector
.
charAt
(
0
)
===
"<"
||
selector
.
charAt
(
selector
.
length
-
1
)
===
">"
)
{
// Assume
that strings that start and end with <>
are HTML and skip the regex check
match
=
[
null
,
selector
,
null
];
}
else
{
match
=
quickExpr
.
exec
(
selector
);
}
...
...
test/unit/core.js
View file @
86aa764f
...
...
@@ -12,7 +12,7 @@ test("Basic requirements", function() {
});
test
(
"jQuery()"
,
function
()
{
expect
(
2
5
);
expect
(
2
9
);
// Basic constructor's behavior
...
...
@@ -96,6 +96,17 @@ test("jQuery()", function() {
// manually clean up detached elements
elem
.
remove
();
equals
(
jQuery
(
" <div/> "
).
length
,
1
,
"Make sure whitespace is trimmed."
);
equals
(
jQuery
(
" a<div/>b "
).
length
,
1
,
"Make sure whitespace and other characters are trimmed."
);
var
long
=
""
;
for
(
var
i
=
0
;
i
<
128
;
i
++
)
{
long
+=
"12345678"
;
}
equals
(
jQuery
(
" <div>"
+
long
+
"</div> "
).
length
,
1
,
"Make sure whitespace is trimmed on long strings."
);
equals
(
jQuery
(
" a<div>"
+
long
+
"</div>b "
).
length
,
1
,
"Make sure whitespace and other characters are trimmed on long strings."
);
});
test
(
"selector state"
,
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