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
3776cbe3
Commit
3776cbe3
authored
Dec 22, 2009
by
jeresig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Standardize on using double-quotes for string literals.
parent
61e37d41
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
30 deletions
+31
-30
ajax.js
src/ajax.js
+1
-1
attributes.js
src/attributes.js
+2
-2
core.js
src/core.js
+1
-1
css.js
src/css.js
+3
-3
event.js
src/event.js
+3
-2
manipulation.js
src/manipulation.js
+1
-1
offset.js
src/offset.js
+19
-19
support.js
src/support.js
+1
-1
No files found.
src/ajax.js
View file @
3776cbe3
...
@@ -604,7 +604,7 @@ jQuery.extend({
...
@@ -604,7 +604,7 @@ jQuery.extend({
function
add
(
key
,
value
)
{
function
add
(
key
,
value
)
{
// If value is a function, invoke it and return its value
// If value is a function, invoke it and return its value
value
=
jQuery
.
isFunction
(
value
)
?
value
()
:
value
;
value
=
jQuery
.
isFunction
(
value
)
?
value
()
:
value
;
s
[
s
.
length
]
=
encodeURIComponent
(
key
)
+
'='
+
encodeURIComponent
(
value
);
s
[
s
.
length
]
=
encodeURIComponent
(
key
)
+
"="
+
encodeURIComponent
(
value
);
}
}
// If an array was passed in, assume that it is an array of form elements.
// If an array was passed in, assume that it is an array of form elements.
...
...
src/attributes.js
View file @
3776cbe3
...
@@ -137,7 +137,7 @@ jQuery.fn.extend({
...
@@ -137,7 +137,7 @@ jQuery.fn.extend({
// Typecast once if the value is a number
// Typecast once if the value is a number
if
(
typeof
value
===
"number"
)
{
if
(
typeof
value
===
"number"
)
{
value
+=
''
;
value
+=
""
;
}
}
var
val
=
value
;
var
val
=
value
;
...
@@ -149,7 +149,7 @@ jQuery.fn.extend({
...
@@ -149,7 +149,7 @@ jQuery.fn.extend({
// Typecast each time if the value is a Function and the appended
// Typecast each time if the value is a Function and the appended
// value is therefore different each time.
// value is therefore different each time.
if
(
typeof
val
===
"number"
)
{
if
(
typeof
val
===
"number"
)
{
val
+=
''
;
val
+=
""
;
}
}
}
}
...
...
src/core.js
View file @
3776cbe3
...
@@ -617,7 +617,7 @@ jQuery.extend({
...
@@ -617,7 +617,7 @@ jQuery.extend({
// Use of jQuery.browser is frowned upon.
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
// More details: http://docs.jquery.com/Utilities/jQuery.browser
browser
:
{
browser
:
{
version
:
(
/.*
?(?:
firefox|safari|opera|msie
)[\/
]([\d
.
]
+
)
/
.
exec
(
userAgent
)
||
[
0
,
'0'
])[
1
],
version
:
(
/.*
?(?:
firefox|safari|opera|msie
)[\/
]([\d
.
]
+
)
/
.
exec
(
userAgent
)
||
[
0
,
"0"
])[
1
],
safari
:
/safari/
.
test
(
userAgent
),
safari
:
/safari/
.
test
(
userAgent
),
opera
:
/opera/
.
test
(
userAgent
),
opera
:
/opera/
.
test
(
userAgent
),
msie
:
/msie/
.
test
(
userAgent
)
&&
!
/opera/
.
test
(
userAgent
),
msie
:
/msie/
.
test
(
userAgent
)
&&
!
/opera/
.
test
(
userAgent
),
...
...
src/css.js
View file @
3776cbe3
...
@@ -56,13 +56,13 @@ jQuery.extend({
...
@@ -56,13 +56,13 @@ jQuery.extend({
style
.
zoom
=
1
;
style
.
zoom
=
1
;
// Set the alpha filter to set the opacity
// Set the alpha filter to set the opacity
var
opacity
=
parseInt
(
value
,
10
)
+
''
===
"NaN"
?
""
:
"alpha(opacity="
+
value
*
100
+
")"
;
var
opacity
=
parseInt
(
value
,
10
)
+
""
===
"NaN"
?
""
:
"alpha(opacity="
+
value
*
100
+
")"
;
var
filter
=
style
.
filter
||
jQuery
.
curCSS
(
elem
,
'filter'
)
||
""
;
var
filter
=
style
.
filter
||
jQuery
.
curCSS
(
elem
,
"filter"
)
||
""
;
style
.
filter
=
ralpha
.
test
(
filter
)
?
filter
.
replace
(
ralpha
,
opacity
)
:
opacity
;
style
.
filter
=
ralpha
.
test
(
filter
)
?
filter
.
replace
(
ralpha
,
opacity
)
:
opacity
;
}
}
return
style
.
filter
&&
style
.
filter
.
indexOf
(
"opacity="
)
>=
0
?
return
style
.
filter
&&
style
.
filter
.
indexOf
(
"opacity="
)
>=
0
?
(
parseFloat
(
ropacity
.
exec
(
style
.
filter
)[
1
]
)
/
100
)
+
''
:
(
parseFloat
(
ropacity
.
exec
(
style
.
filter
)[
1
]
)
/
100
)
+
""
:
""
;
""
;
}
}
...
...
src/event.js
View file @
3776cbe3
...
@@ -230,6 +230,7 @@ jQuery.event = {
...
@@ -230,6 +230,7 @@ jQuery.event = {
if ( !elem ) {
if ( !elem ) {
// Don't bubble custom events when global (to avoid too much overhead)
// Don't bubble custom events when global (to avoid too much overhead)
event.stopPropagation();
event.stopPropagation();
// Only trigger if we've ever bound an event for it
// Only trigger if we've ever bound an event for it
if ( this.global[ type ] ) {
if ( this.global[ type ] ) {
jQuery.each( jQuery.cache, function() {
jQuery.each( jQuery.cache, function() {
...
@@ -824,8 +825,8 @@ jQuery.fn.extend({
...
@@ -824,8 +825,8 @@ jQuery.fn.extend({
return this.click( jQuery.event.proxy( fn, function( event ) {
return this.click( jQuery.event.proxy( fn, function( event ) {
// Figure out which function to execute
// Figure out which function to execute
var lastToggle = ( jQuery.data( this,
'lastToggle'
+ fn.guid ) || 0 ) % i;
var lastToggle = ( jQuery.data( this,
"
lastToggle
"
+ fn.guid ) || 0 ) % i;
jQuery.data( this,
'lastToggle'
+ fn.guid, lastToggle + 1 );
jQuery.data( this,
"
lastToggle
"
+ fn.guid, lastToggle + 1 );
// Make sure that clicks stop
// Make sure that clicks stop
event.preventDefault();
event.preventDefault();
...
...
src/manipulation.js
View file @
3776cbe3
...
@@ -380,7 +380,7 @@ jQuery.extend({
...
@@ -380,7 +380,7 @@ jQuery.extend({
jQuery
.
each
(
elems
,
function
(
i
,
elem
)
{
jQuery
.
each
(
elems
,
function
(
i
,
elem
)
{
if
(
typeof
elem
===
"number"
)
{
if
(
typeof
elem
===
"number"
)
{
elem
+=
''
;
elem
+=
""
;
}
}
if
(
!
elem
)
{
if
(
!
elem
)
{
...
...
src/offset.js
View file @
3776cbe3
...
@@ -95,10 +95,10 @@ if ( "getBoundingClientRect" in document.documentElement ) {
...
@@ -95,10 +95,10 @@ if ( "getBoundingClientRect" in document.documentElement ) {
jQuery
.
offset
=
{
jQuery
.
offset
=
{
initialize
:
function
()
{
initialize
:
function
()
{
var
body
=
document
.
body
,
container
=
document
.
createElement
(
'div'
),
innerDiv
,
checkDiv
,
table
,
td
,
bodyMarginTop
=
parseFloat
(
jQuery
.
curCSS
(
body
,
'marginTop'
,
true
)
)
||
0
,
var
body
=
document
.
body
,
container
=
document
.
createElement
(
"div"
),
innerDiv
,
checkDiv
,
table
,
td
,
bodyMarginTop
=
parseFloat
(
jQuery
.
curCSS
(
body
,
"marginTop"
,
true
)
)
||
0
,
html
=
'<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>'
;
html
=
"<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"
;
jQuery
.
extend
(
container
.
style
,
{
position
:
'absolute'
,
top
:
0
,
left
:
0
,
margin
:
0
,
border
:
0
,
width
:
'1px'
,
height
:
'1px'
,
visibility
:
'hidden'
}
);
jQuery
.
extend
(
container
.
style
,
{
position
:
"absolute"
,
top
:
0
,
left
:
0
,
margin
:
0
,
border
:
0
,
width
:
"1px"
,
height
:
"1px"
,
visibility
:
"hidden"
}
);
container
.
innerHTML
=
html
;
container
.
innerHTML
=
html
;
body
.
insertBefore
(
container
,
body
.
firstChild
);
body
.
insertBefore
(
container
,
body
.
firstChild
);
...
@@ -109,12 +109,12 @@ jQuery.offset = {
...
@@ -109,12 +109,12 @@ jQuery.offset = {
this
.
doesNotAddBorder
=
(
checkDiv
.
offsetTop
!==
5
);
this
.
doesNotAddBorder
=
(
checkDiv
.
offsetTop
!==
5
);
this
.
doesAddBorderForTableAndCells
=
(
td
.
offsetTop
===
5
);
this
.
doesAddBorderForTableAndCells
=
(
td
.
offsetTop
===
5
);
checkDiv
.
style
.
position
=
'fixed'
,
checkDiv
.
style
.
top
=
'20px'
;
checkDiv
.
style
.
position
=
"fixed"
,
checkDiv
.
style
.
top
=
"20px"
;
// safari subtracts parent border width here which is 5px
// safari subtracts parent border width here which is 5px
this
.
supportsFixedPosition
=
(
checkDiv
.
offsetTop
===
20
||
checkDiv
.
offsetTop
===
15
);
this
.
supportsFixedPosition
=
(
checkDiv
.
offsetTop
===
20
||
checkDiv
.
offsetTop
===
15
);
checkDiv
.
style
.
position
=
checkDiv
.
style
.
top
=
''
;
checkDiv
.
style
.
position
=
checkDiv
.
style
.
top
=
""
;
innerDiv
.
style
.
overflow
=
'hidden'
,
innerDiv
.
style
.
position
=
'relative'
;
innerDiv
.
style
.
overflow
=
"hidden"
,
innerDiv
.
style
.
position
=
"relative"
;
this
.
subtractsBorderForOverflowNotVisible
=
(
checkDiv
.
offsetTop
===
-
5
);
this
.
subtractsBorderForOverflowNotVisible
=
(
checkDiv
.
offsetTop
===
-
5
);
this
.
doesNotIncludeMarginInBodyOffset
=
(
body
.
offsetTop
!==
bodyMarginTop
);
this
.
doesNotIncludeMarginInBodyOffset
=
(
body
.
offsetTop
!==
bodyMarginTop
);
...
@@ -130,8 +130,8 @@ jQuery.offset = {
...
@@ -130,8 +130,8 @@ jQuery.offset = {
jQuery
.
offset
.
initialize
();
jQuery
.
offset
.
initialize
();
if
(
jQuery
.
offset
.
doesNotIncludeMarginInBodyOffset
)
{
if
(
jQuery
.
offset
.
doesNotIncludeMarginInBodyOffset
)
{
top
+=
parseFloat
(
jQuery
.
curCSS
(
body
,
'marginTop'
,
true
)
)
||
0
;
top
+=
parseFloat
(
jQuery
.
curCSS
(
body
,
"marginTop"
,
true
)
)
||
0
;
left
+=
parseFloat
(
jQuery
.
curCSS
(
body
,
'marginLeft'
,
true
)
)
||
0
;
left
+=
parseFloat
(
jQuery
.
curCSS
(
body
,
"marginLeft"
,
true
)
)
||
0
;
}
}
return
{
top
:
top
,
left
:
left
};
return
{
top
:
top
,
left
:
left
};
...
@@ -139,19 +139,19 @@ jQuery.offset = {
...
@@ -139,19 +139,19 @@ jQuery.offset = {
setOffset
:
function
(
elem
,
options
)
{
setOffset
:
function
(
elem
,
options
)
{
// set position first, in-case top/left are set even on static elem
// set position first, in-case top/left are set even on static elem
if
(
/static/
.
test
(
jQuery
.
curCSS
(
elem
,
'position'
)
)
)
{
if
(
/static/
.
test
(
jQuery
.
curCSS
(
elem
,
"position"
)
)
)
{
elem
.
style
.
position
=
'relative'
;
elem
.
style
.
position
=
"relative"
;
}
}
var
curElem
=
jQuery
(
elem
),
var
curElem
=
jQuery
(
elem
),
curOffset
=
curElem
.
offset
(),
curOffset
=
curElem
.
offset
(),
curTop
=
parseInt
(
jQuery
.
curCSS
(
elem
,
'top'
,
true
),
10
)
||
0
,
curTop
=
parseInt
(
jQuery
.
curCSS
(
elem
,
"top"
,
true
),
10
)
||
0
,
curLeft
=
parseInt
(
jQuery
.
curCSS
(
elem
,
'left'
,
true
),
10
)
||
0
,
curLeft
=
parseInt
(
jQuery
.
curCSS
(
elem
,
"left"
,
true
),
10
)
||
0
,
props
=
{
props
=
{
top
:
(
options
.
top
-
curOffset
.
top
)
+
curTop
,
top
:
(
options
.
top
-
curOffset
.
top
)
+
curTop
,
left
:
(
options
.
left
-
curOffset
.
left
)
+
curLeft
left
:
(
options
.
left
-
curOffset
.
left
)
+
curLeft
};
};
if
(
'using'
in
options
)
{
if
(
"using"
in
options
)
{
options
.
using
.
call
(
elem
,
props
);
options
.
using
.
call
(
elem
,
props
);
}
else
{
}
else
{
curElem
.
css
(
props
);
curElem
.
css
(
props
);
...
@@ -178,12 +178,12 @@ jQuery.fn.extend({
...
@@ -178,12 +178,12 @@ jQuery.fn.extend({
// Subtract element margins
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
// are the same in Safari causing offset.left to incorrectly be 0
offset
.
top
-=
parseFloat
(
jQuery
.
curCSS
(
elem
,
'marginTop'
,
true
)
)
||
0
;
offset
.
top
-=
parseFloat
(
jQuery
.
curCSS
(
elem
,
"marginTop"
,
true
)
)
||
0
;
offset
.
left
-=
parseFloat
(
jQuery
.
curCSS
(
elem
,
'marginLeft'
,
true
)
)
||
0
;
offset
.
left
-=
parseFloat
(
jQuery
.
curCSS
(
elem
,
"marginLeft"
,
true
)
)
||
0
;
// Add offsetParent borders
// Add offsetParent borders
parentOffset
.
top
+=
parseFloat
(
jQuery
.
curCSS
(
offsetParent
[
0
],
'borderTopWidth'
,
true
)
)
||
0
;
parentOffset
.
top
+=
parseFloat
(
jQuery
.
curCSS
(
offsetParent
[
0
],
"borderTopWidth"
,
true
)
)
||
0
;
parentOffset
.
left
+=
parseFloat
(
jQuery
.
curCSS
(
offsetParent
[
0
],
'borderLeftWidth'
,
true
)
)
||
0
;
parentOffset
.
left
+=
parseFloat
(
jQuery
.
curCSS
(
offsetParent
[
0
],
"borderLeftWidth"
,
true
)
)
||
0
;
// Subtract the two offsets
// Subtract the two offsets
return
{
return
{
...
@@ -195,7 +195,7 @@ jQuery.fn.extend({
...
@@ -195,7 +195,7 @@ jQuery.fn.extend({
offsetParent
:
function
()
{
offsetParent
:
function
()
{
return
this
.
map
(
function
()
{
return
this
.
map
(
function
()
{
var
offsetParent
=
this
.
offsetParent
||
document
.
body
;
var
offsetParent
=
this
.
offsetParent
||
document
.
body
;
while
(
offsetParent
&&
(
!
/^body|html$/i
.
test
(
offsetParent
.
nodeName
)
&&
jQuery
.
css
(
offsetParent
,
'position'
)
===
'static'
)
)
{
while
(
offsetParent
&&
(
!
/^body|html$/i
.
test
(
offsetParent
.
nodeName
)
&&
jQuery
.
css
(
offsetParent
,
"position"
)
===
"static"
)
)
{
offsetParent
=
offsetParent
.
offsetParent
;
offsetParent
=
offsetParent
.
offsetParent
;
}
}
return
offsetParent
;
return
offsetParent
;
...
@@ -234,7 +234,7 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
...
@@ -234,7 +234,7 @@ jQuery.each( ["Left", "Top"], function( i, name ) {
win
=
getWindow
(
elem
);
win
=
getWindow
(
elem
);
// Return the scroll offset
// Return the scroll offset
return
win
?
(
'pageXOffset'
in
win
)
?
win
[
i
?
'pageYOffset'
:
'pageXOffset'
]
:
return
win
?
(
"pageXOffset"
in
win
)
?
win
[
i
?
"pageYOffset"
:
"pageXOffset"
]
:
jQuery
.
support
.
boxModel
&&
win
.
document
.
documentElement
[
method
]
||
jQuery
.
support
.
boxModel
&&
win
.
document
.
documentElement
[
method
]
||
win
.
document
.
body
[
method
]
:
win
.
document
.
body
[
method
]
:
elem
[
method
];
elem
[
method
];
...
...
src/support.js
View file @
3776cbe3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
id
=
"script"
+
now
();
id
=
"script"
+
now
();
div
.
style
.
display
=
"none"
;
div
.
style
.
display
=
"none"
;
div
.
innerHTML
=
' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.55;">a</a><select><option>text</option></select>'
;
div
.
innerHTML
=
" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><select><option>text</option></select>"
;
var
all
=
div
.
getElementsByTagName
(
"*"
),
var
all
=
div
.
getElementsByTagName
(
"*"
),
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
...
...
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