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
e2bace8f
Commit
e2bace8f
authored
Apr 29, 2011
by
Dave Methvin
Browse files
Options
Browse Files
Download
Plain Diff
Merged pull request #361 from rwldrn/9008a.
Restored /g flag to rspaces; Adds unit tests; Supplements #9008
parents
e5f4ec84
bf678fd9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
8 deletions
+24
-8
ajax.js
src/ajax.js
+3
-3
attributes.js
src/attributes.js
+4
-4
event.js
src/event.js
+1
-1
event.js
test/unit/event.js
+16
-0
No files found.
src/ajax.js
View file @
e2bace8f
...
@@ -13,7 +13,7 @@ var r20 = /%20/g,
...
@@ -13,7 +13,7 @@ var r20 = /%20/g,
rquery
=
/
\?
/
,
rquery
=
/
\?
/
,
rscript
=
/<script
\b[^
<
]
*
(?:(?!
<
\/
script>
)
<
[^
<
]
*
)
*<
\/
script>/gi
,
rscript
=
/<script
\b[^
<
]
*
(?:(?!
<
\/
script>
)
<
[^
<
]
*
)
*<
\/
script>/gi
,
rselectTextarea
=
/^
(?:
select|textarea
)
/i
,
rselectTextarea
=
/^
(?:
select|textarea
)
/i
,
rspaces
=
/
\s
+/
,
rspaces
Ajax
=
/
\s
+/
,
rts
=
/
([
?&
])
_=
[^
&
]
*/
,
rts
=
/
([
?&
])
_=
[^
&
]
*/
,
rurl
=
/^
([\w\+\.\-]
+:
)(?:\/\/([^\/
?#:
]
*
)(?:
:
(\d
+
))?)?
/
,
rurl
=
/^
([\w\+\.\-]
+:
)(?:\/\/([^\/
?#:
]
*
)(?:
:
(\d
+
))?)?
/
,
...
@@ -71,7 +71,7 @@ function addToPrefiltersOrTransports( structure ) {
...
@@ -71,7 +71,7 @@ function addToPrefiltersOrTransports( structure ) {
}
}
if
(
jQuery
.
isFunction
(
func
)
)
{
if
(
jQuery
.
isFunction
(
func
)
)
{
var
dataTypes
=
dataTypeExpression
.
toLowerCase
().
split
(
rspaces
),
var
dataTypes
=
dataTypeExpression
.
toLowerCase
().
split
(
rspaces
Ajax
),
i
=
0
,
i
=
0
,
length
=
dataTypes
.
length
,
length
=
dataTypes
.
length
,
dataType
,
dataType
,
...
@@ -599,7 +599,7 @@ jQuery.extend({
...
@@ -599,7 +599,7 @@ jQuery.extend({
s
.
url
=
(
(
url
||
s
.
url
)
+
""
).
replace
(
rhash
,
""
).
replace
(
rprotocol
,
ajaxLocParts
[
1
]
+
"//"
);
s
.
url
=
(
(
url
||
s
.
url
)
+
""
).
replace
(
rhash
,
""
).
replace
(
rprotocol
,
ajaxLocParts
[
1
]
+
"//"
);
// Extract dataTypes list
// Extract dataTypes list
s
.
dataTypes
=
jQuery
.
trim
(
s
.
dataType
||
"*"
).
toLowerCase
().
split
(
rspaces
);
s
.
dataTypes
=
jQuery
.
trim
(
s
.
dataType
||
"*"
).
toLowerCase
().
split
(
rspaces
Ajax
);
// Determine if a cross-domain request is in order
// Determine if a cross-domain request is in order
if
(
s
.
crossDomain
==
null
)
{
if
(
s
.
crossDomain
==
null
)
{
...
...
src/attributes.js
View file @
e2bace8f
(
function
(
jQuery
)
{
(
function
(
jQuery
)
{
var
rclass
=
/
[\n\t\r]
/g
,
var
rclass
=
/
[\n\t\r]
/g
,
rspace
s
=
/
\s
+/
,
rspace
=
/
\s
+/
,
rreturn
=
/
\r
/g
,
rreturn
=
/
\r
/g
,
rtype
=
/^
(?:
button|input
)
$/i
,
rtype
=
/^
(?:
button|input
)
$/i
,
rfocusable
=
/^
(?:
button|input|object|select|textarea
)
$/i
,
rfocusable
=
/^
(?:
button|input|object|select|textarea
)
$/i
,
...
@@ -43,7 +43,7 @@ jQuery.fn.extend({
...
@@ -43,7 +43,7 @@ jQuery.fn.extend({
}
}
if
(
value
&&
typeof
value
===
"string"
)
{
if
(
value
&&
typeof
value
===
"string"
)
{
var
classNames
=
(
value
||
""
).
split
(
rspace
s
);
var
classNames
=
(
value
||
""
).
split
(
rspace
);
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
var
elem
=
this
[
i
];
var
elem
=
this
[
i
];
...
@@ -79,7 +79,7 @@ jQuery.fn.extend({
...
@@ -79,7 +79,7 @@ jQuery.fn.extend({
}
}
if
(
(
value
&&
typeof
value
===
"string"
)
||
value
===
undefined
)
{
if
(
(
value
&&
typeof
value
===
"string"
)
||
value
===
undefined
)
{
var
classNames
=
(
value
||
""
).
split
(
rspace
s
);
var
classNames
=
(
value
||
""
).
split
(
rspace
);
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
var
elem
=
this
[
i
];
var
elem
=
this
[
i
];
...
@@ -120,7 +120,7 @@ jQuery.fn.extend({
...
@@ -120,7 +120,7 @@ jQuery.fn.extend({
i
=
0
,
i
=
0
,
self
=
jQuery
(
this
),
self
=
jQuery
(
this
),
state
=
stateVal
,
state
=
stateVal
,
classNames
=
value
.
split
(
rspace
s
);
classNames
=
value
.
split
(
rspace
);
while
(
(
className
=
classNames
[
i
++
])
)
{
while
(
(
className
=
classNames
[
i
++
])
)
{
// check each className given, space seperated list
// check each className given, space seperated list
...
...
src/event.js
View file @
e2bace8f
...
@@ -4,7 +4,7 @@ var hasOwn = Object.prototype.hasOwnProperty,
...
@@ -4,7 +4,7 @@ var hasOwn = Object.prototype.hasOwnProperty,
rnamespaces
=
/
\.(
.*
)
$/
,
rnamespaces
=
/
\.(
.*
)
$/
,
rformElems
=
/^
(?:
textarea|input|select
)
$/i
,
rformElems
=
/^
(?:
textarea|input|select
)
$/i
,
rperiod
=
/
\.
/g
,
rperiod
=
/
\.
/g
,
rspaces
=
/
\s
+/
,
rspaces
=
/
/g
,
rescape
=
/
[^\w\s
.|`
]
/g
,
rescape
=
/
[^\w\s
.|`
]
/g
,
fcleanup
=
function
(
nm
)
{
fcleanup
=
function
(
nm
)
{
return
nm
.
replace
(
rescape
,
"
\\
$&"
);
return
nm
.
replace
(
rescape
,
"
\\
$&"
);
...
...
test/unit/event.js
View file @
e2bace8f
...
@@ -68,6 +68,22 @@ test("bind(), multiple events at once", function() {
...
@@ -68,6 +68,22 @@ test("bind(), multiple events at once", function() {
equals
(
mouseoverCounter
,
1
,
"bind() with multiple events at once"
);
equals
(
mouseoverCounter
,
1
,
"bind() with multiple events at once"
);
});
});
test
(
"bind(), five events at once"
,
function
()
{
expect
(
1
);
var
count
=
0
,
handler
=
function
(
event
)
{
count
++
;
};
jQuery
(
"#firstp"
).
bind
(
"click mouseover foo bar baz"
,
handler
)
.
trigger
(
"click"
).
trigger
(
"mouseover"
)
.
trigger
(
"foo"
).
trigger
(
"bar"
)
.
trigger
(
"baz"
);
equals
(
count
,
5
,
"bind() five events at once"
);
});
test
(
"bind(), multiple events at once and namespaces"
,
function
()
{
test
(
"bind(), multiple events at once and namespaces"
,
function
()
{
expect
(
7
);
expect
(
7
);
...
...
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