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
3a68c114
Commit
3a68c114
authored
Mar 04, 2014
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajax: .load() should trim its selector
Fixes #14773
parent
10efa1f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
load.js
src/ajax/load.js
+1
-1
test3.html
test/data/test3.html
+1
-0
ajax.js
test/unit/ajax.js
+8
-0
No files found.
src/ajax/load.js
View file @
3a68c114
...
...
@@ -25,7 +25,7 @@ jQuery.fn.load = function( url, params, callback ) {
off
=
url
.
indexOf
(
" "
);
if
(
off
>=
0
)
{
selector
=
url
.
slice
(
off
);
selector
=
jQuery
.
trim
(
url
.
slice
(
off
)
);
url
=
url
.
slice
(
0
,
off
);
}
...
...
test/data/test3.html
View file @
3a68c114
<div
class=
"user"
>
This is a user
</div>
<div
class=
"user"
>
This is a user
</div>
<div
class=
"teacher"
>
This is a teacher
</div>
<div
id=
"superuser"
>
This is a superuser
</div>
test/unit/ajax.js
View file @
3a68c114
...
...
@@ -1807,6 +1807,14 @@ module( "ajax", {
});
});
// Selector should be trimmed to avoid leading spaces (#14773)
asyncTest
(
"jQuery.fn.load( URL_SELECTOR with spaces )"
,
1
,
function
()
{
jQuery
(
"#first"
).
load
(
"data/test3.html #superuser "
,
function
()
{
strictEqual
(
jQuery
(
this
).
children
(
"div"
).
length
,
1
,
"Verify that specific elements were injected"
);
start
();
});
});
asyncTest
(
"jQuery.fn.load( String, Function ) - simple: inject text into DOM"
,
2
,
function
()
{
jQuery
(
"#first"
).
load
(
url
(
"data/name.html"
),
function
()
{
ok
(
/^ERROR/
.
test
(
jQuery
(
"#first"
).
text
()),
"Check if content was injected into the DOM"
);
...
...
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