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
ddb86f8d
Commit
ddb86f8d
authored
Nov 27, 2009
by
Karl Swedberg
Committed by
John Resig
Nov 27, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added curly braces around all if/else statements
parent
1879e8cb
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
149 additions
and
121 deletions
+149
-121
ajax.js
src/ajax.js
+10
-10
attributes.js
src/attributes.js
+34
-30
data.js
src/data.js
+18
-16
dimensions.js
src/dimensions.js
+1
-1
event.js
src/event.js
+24
-20
fx.js
src/fx.js
+57
-42
traversing.js
src/traversing.js
+5
-2
No files found.
src/ajax.js
View file @
ddb86f8d
...
@@ -604,19 +604,19 @@ jQuery.extend({
...
@@ -604,19 +604,19 @@ jQuery.extend({
// If an array was passed in, assume that it is an array
// If an array was passed in, assume that it is an array
// of form elements
// of form elements
if
(
jQuery
.
isArray
(
a
)
||
a
.
jquery
)
if
(
jQuery
.
isArray
(
a
)
||
a
.
jquery
)
{
// Serialize the form elements
// Serialize the form elements
jQuery
.
each
(
a
,
function
()
{
jQuery
.
each
(
a
,
function
()
{
add
(
this
.
name
,
this
.
value
);
add
(
this
.
name
,
this
.
value
);
});
});
else
}
else
{
// Encode parameters from object, recursively. If
// Encode parameters from object, recursively. If
// jQuery.param.traditional is set, encode the "old" way
// jQuery.param.traditional is set, encode the "old" way
// (the way 1.3.2 or older did it)
// (the way 1.3.2 or older did it)
jQuery
.
each
(
a
,
function
buildParams
(
prefix
,
obj
)
{
jQuery
.
each
(
a
,
function
buildParams
(
prefix
,
obj
)
{
if
(
jQuery
.
isArray
(
obj
)
)
if
(
jQuery
.
isArray
(
obj
)
)
{
jQuery
.
each
(
obj
,
function
(
i
,
v
){
jQuery
.
each
(
obj
,
function
(
i
,
v
){
// Due to rails' limited request param syntax, numeric array
// Due to rails' limited request param syntax, numeric array
// indices are not supported. To avoid serialization ambiguity
// indices are not supported. To avoid serialization ambiguity
...
@@ -626,20 +626,20 @@ jQuery.extend({
...
@@ -626,20 +626,20 @@ jQuery.extend({
add
(
prefix
+
(
param_traditional
?
""
:
"[]"
),
v
);
add
(
prefix
+
(
param_traditional
?
""
:
"[]"
),
v
);
});
});
else
if
(
typeof
obj
==
"object"
)
}
else
if
(
typeof
obj
==
"object"
)
{
if
(
param_traditional
)
if
(
param_traditional
)
{
add
(
prefix
,
obj
);
add
(
prefix
,
obj
);
else
}
else
{
jQuery
.
each
(
obj
,
function
(
k
,
v
){
jQuery
.
each
(
obj
,
function
(
k
,
v
){
buildParams
(
prefix
?
prefix
+
"["
+
k
+
"]"
:
k
,
v
);
buildParams
(
prefix
?
prefix
+
"["
+
k
+
"]"
:
k
,
v
);
});
});
}
else
}
else
{
add
(
prefix
,
obj
);
add
(
prefix
,
obj
);
}
});
});
}
// Return the resulting serialization
// Return the resulting serialization
return
s
.
join
(
"&"
).
replace
(
r20
,
"+"
);
return
s
.
join
(
"&"
).
replace
(
r20
,
"+"
);
}
}
...
...
src/attributes.js
View file @
ddb86f8d
...
@@ -68,9 +68,9 @@ jQuery.fn.extend({
...
@@ -68,9 +68,9 @@ jQuery.fn.extend({
var
elem
=
this
[
0
];
var
elem
=
this
[
0
];
if
(
elem
)
{
if
(
elem
)
{
if
(
jQuery
.
nodeName
(
elem
,
'option'
)
)
if
(
jQuery
.
nodeName
(
elem
,
'option'
)
)
{
return
(
elem
.
attributes
.
value
||
{}).
specified
?
elem
.
value
:
elem
.
text
;
return
(
elem
.
attributes
.
value
||
{}).
specified
?
elem
.
value
:
elem
.
text
;
}
// We need to handle select boxes special
// We need to handle select boxes special
if
(
jQuery
.
nodeName
(
elem
,
"select"
)
)
{
if
(
jQuery
.
nodeName
(
elem
,
"select"
)
)
{
var
index
=
elem
.
selectedIndex
,
var
index
=
elem
.
selectedIndex
,
...
@@ -79,9 +79,9 @@ jQuery.fn.extend({
...
@@ -79,9 +79,9 @@ jQuery.fn.extend({
one
=
elem
.
type
==
"select-one"
;
one
=
elem
.
type
==
"select-one"
;
// Nothing was selected
// Nothing was selected
if
(
index
<
0
)
if
(
index
<
0
)
{
return
null
;
return
null
;
}
// Loop through all the selected options
// Loop through all the selected options
for
(
var
i
=
one
?
index
:
0
,
max
=
one
?
index
+
1
:
options
.
length
;
i
<
max
;
i
++
)
{
for
(
var
i
=
one
?
index
:
0
,
max
=
one
?
index
+
1
:
options
.
length
;
i
<
max
;
i
++
)
{
var
option
=
options
[
i
];
var
option
=
options
[
i
];
...
@@ -91,9 +91,9 @@ jQuery.fn.extend({
...
@@ -91,9 +91,9 @@ jQuery.fn.extend({
value
=
jQuery
(
option
).
val
();
value
=
jQuery
(
option
).
val
();
// We don't need an array for one selects
// We don't need an array for one selects
if
(
one
)
if
(
one
)
{
return
value
;
return
value
;
}
// Multi-Selects return an array
// Multi-Selects return an array
values
.
push
(
value
);
values
.
push
(
value
);
}
}
...
@@ -111,9 +111,9 @@ jQuery.fn.extend({
...
@@ -111,9 +111,9 @@ 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
;
return
this
.
each
(
function
(){
return
this
.
each
(
function
(){
...
@@ -121,15 +121,17 @@ jQuery.fn.extend({
...
@@ -121,15 +121,17 @@ jQuery.fn.extend({
val
=
value
.
call
(
this
);
val
=
value
.
call
(
this
);
// 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"
)
val
+=
''
;
if
(
typeof
val
===
"number"
)
{
val
+=
''
;
}
}
}
if
(
this
.
nodeType
!=
1
)
if
(
this
.
nodeType
!=
1
)
{
return
;
return
;
}
if
(
jQuery
.
isArray
(
val
)
&&
/radio|checkbox/
.
test
(
this
.
type
)
)
if
(
jQuery
.
isArray
(
val
)
&&
/radio|checkbox/
.
test
(
this
.
type
)
)
{
this
.
checked
=
jQuery
.
inArray
(
this
.
value
||
this
.
name
,
val
)
>=
0
;
this
.
checked
=
jQuery
.
inArray
(
this
.
value
||
this
.
name
,
val
)
>=
0
;
}
else
if
(
jQuery
.
nodeName
(
this
,
"select"
)
)
{
else
if
(
jQuery
.
nodeName
(
this
,
"select"
)
)
{
var
values
=
jQuery
.
makeArray
(
val
);
var
values
=
jQuery
.
makeArray
(
val
);
...
@@ -137,11 +139,12 @@ jQuery.fn.extend({
...
@@ -137,11 +139,12 @@ jQuery.fn.extend({
this
.
selected
=
jQuery
.
inArray
(
this
.
value
||
this
.
text
,
values
)
>=
0
;
this
.
selected
=
jQuery
.
inArray
(
this
.
value
||
this
.
text
,
values
)
>=
0
;
});
});
if
(
!
values
.
length
)
if
(
!
values
.
length
)
{
this
.
selectedIndex
=
-
1
;
this
.
selectedIndex
=
-
1
;
}
}
else
}
else
{
this
.
value
=
val
;
this
.
value
=
val
;
}
});
});
}
}
});
});
...
@@ -149,8 +152,9 @@ jQuery.fn.extend({
...
@@ -149,8 +152,9 @@ jQuery.fn.extend({
jQuery
.
each
({
jQuery
.
each
({
removeAttr
:
function
(
name
)
{
removeAttr
:
function
(
name
)
{
jQuery
.
attr
(
this
,
name
,
""
);
jQuery
.
attr
(
this
,
name
,
""
);
if
(
this
.
nodeType
==
1
)
if
(
this
.
nodeType
==
1
)
{
this
.
removeAttribute
(
name
);
this
.
removeAttribute
(
name
);
}
},
},
toggleClass
:
function
(
classNames
,
state
)
{
toggleClass
:
function
(
classNames
,
state
)
{
...
@@ -182,9 +186,9 @@ jQuery.each({
...
@@ -182,9 +186,9 @@ jQuery.each({
jQuery
.
extend
({
jQuery
.
extend
({
attr
:
function
(
elem
,
name
,
value
)
{
attr
:
function
(
elem
,
name
,
value
)
{
// don't set attributes on text and comment nodes
// don't set attributes on text and comment nodes
if
(
!
elem
||
elem
.
nodeType
==
3
||
elem
.
nodeType
==
8
)
if
(
!
elem
||
elem
.
nodeType
==
3
||
elem
.
nodeType
==
8
)
{
return
undefined
;
return
undefined
;
}
if
(
name
in
jQuery
.
fn
&&
name
!==
"attr"
)
{
if
(
name
in
jQuery
.
fn
&&
name
!==
"attr"
)
{
return
jQuery
(
elem
)[
name
](
value
);
return
jQuery
(
elem
)[
name
](
value
);
}
}
...
@@ -204,23 +208,23 @@ jQuery.extend({
...
@@ -204,23 +208,23 @@ jQuery.extend({
// Safari mis-reports the default selected property of a hidden option
// Safari mis-reports the default selected property of a hidden option
// Accessing the parent's selectedIndex property fixes it
// Accessing the parent's selectedIndex property fixes it
if
(
name
==
"selected"
&&
elem
.
parentNode
)
if
(
name
==
"selected"
&&
elem
.
parentNode
)
{
elem
.
parentNode
.
selectedIndex
;
elem
.
parentNode
.
selectedIndex
;
}
// If applicable, access the attribute via the DOM 0 way
// If applicable, access the attribute via the DOM 0 way
if
(
name
in
elem
&&
notxml
&&
!
special
)
{
if
(
name
in
elem
&&
notxml
&&
!
special
)
{
if
(
set
){
if
(
set
)
{
// We can't allow the type property to be changed (since it causes problems in IE)
// We can't allow the type property to be changed (since it causes problems in IE)
if
(
name
==
"type"
&&
/
(
button|input
)
/i
.
test
(
elem
.
nodeName
)
&&
elem
.
parentNode
)
if
(
name
==
"type"
&&
/
(
button|input
)
/i
.
test
(
elem
.
nodeName
)
&&
elem
.
parentNode
)
{
throw
"type property can't be changed"
;
throw
"type property can't be changed"
;
}
elem
[
name
]
=
value
;
elem
[
name
]
=
value
;
}
}
// browsers index elements by id/name on forms, give priority to attributes.
// browsers index elements by id/name on forms, give priority to attributes.
if
(
jQuery
.
nodeName
(
elem
,
"form"
)
&&
elem
.
getAttributeNode
(
name
)
)
if
(
jQuery
.
nodeName
(
elem
,
"form"
)
&&
elem
.
getAttributeNode
(
name
)
)
{
return
elem
.
getAttributeNode
(
name
).
nodeValue
;
return
elem
.
getAttributeNode
(
name
).
nodeValue
;
}
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
if
(
name
==
"tabIndex"
)
{
if
(
name
==
"tabIndex"
)
{
...
@@ -238,16 +242,16 @@ jQuery.extend({
...
@@ -238,16 +242,16 @@ jQuery.extend({
}
}
if
(
!
jQuery
.
support
.
style
&&
notxml
&&
name
==
"style"
)
{
if
(
!
jQuery
.
support
.
style
&&
notxml
&&
name
==
"style"
)
{
if
(
set
)
if
(
set
)
{
elem
.
style
.
cssText
=
""
+
value
;
elem
.
style
.
cssText
=
""
+
value
;
}
return
elem
.
style
.
cssText
;
return
elem
.
style
.
cssText
;
}
}
if
(
set
)
if
(
set
)
{
// convert the value to a string (all browsers do this but IE) see #1070
// convert the value to a string (all browsers do this but IE) see #1070
elem
.
setAttribute
(
name
,
""
+
value
);
elem
.
setAttribute
(
name
,
""
+
value
);
}
var
attr
=
!
jQuery
.
support
.
hrefNormalized
&&
notxml
&&
special
var
attr
=
!
jQuery
.
support
.
hrefNormalized
&&
notxml
&&
special
// Some attributes require a special call on IE
// Some attributes require a special call on IE
?
elem
.
getAttribute
(
name
,
2
)
?
elem
.
getAttribute
(
name
,
2
)
...
...
src/data.js
View file @
ddb86f8d
...
@@ -80,19 +80,19 @@ jQuery.extend({
...
@@ -80,19 +80,19 @@ jQuery.extend({
},
},
queue
:
function
(
elem
,
type
,
data
)
{
queue
:
function
(
elem
,
type
,
data
)
{
if
(
!
elem
)
return
;
if
(
!
elem
)
{
return
;
}
type
=
(
type
||
"fx"
)
+
"queue"
;
type
=
(
type
||
"fx"
)
+
"queue"
;
var
q
=
jQuery
.
data
(
elem
,
type
);
var
q
=
jQuery
.
data
(
elem
,
type
);
// Speed up dequeue by getting out quickly if this is just a lookup
// Speed up dequeue by getting out quickly if this is just a lookup
if
(
!
data
)
return
q
||
[];
if
(
!
data
)
{
return
q
||
[];
}
if
(
!
q
||
jQuery
.
isArray
(
data
)
)
if
(
!
q
||
jQuery
.
isArray
(
data
)
)
{
q
=
jQuery
.
data
(
elem
,
type
,
jQuery
.
makeArray
(
data
)
);
q
=
jQuery
.
data
(
elem
,
type
,
jQuery
.
makeArray
(
data
)
);
else
}
else
{
q
.
push
(
data
);
q
.
push
(
data
);
}
return
q
;
return
q
;
},
},
...
@@ -102,12 +102,12 @@ jQuery.extend({
...
@@ -102,12 +102,12 @@ jQuery.extend({
var
queue
=
jQuery
.
queue
(
elem
,
type
),
fn
=
queue
.
shift
();
var
queue
=
jQuery
.
queue
(
elem
,
type
),
fn
=
queue
.
shift
();
// If the fx queue is dequeued, always remove the progress sentinel
// If the fx queue is dequeued, always remove the progress sentinel
if
(
fn
===
"inprogress"
)
fn
=
queue
.
shift
();
if
(
fn
===
"inprogress"
)
{
fn
=
queue
.
shift
();
}
if
(
fn
)
{
if
(
fn
)
{
// Add a progress sentinel to prevent the fx queue from being
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
// automatically dequeued
if
(
type
==
"fx"
)
queue
.
unshift
(
"inprogress"
);
if
(
type
==
"fx"
)
{
queue
.
unshift
(
"inprogress"
);
}
fn
.
call
(
elem
,
function
()
{
jQuery
.
dequeue
(
elem
,
type
);
});
fn
.
call
(
elem
,
function
()
{
jQuery
.
dequeue
(
elem
,
type
);
});
}
}
...
@@ -126,16 +126,17 @@ jQuery.fn.extend({
...
@@ -126,16 +126,17 @@ jQuery.fn.extend({
if
(
value
===
undefined
)
{
if
(
value
===
undefined
)
{
var
data
=
this
.
triggerHandler
(
"getData"
+
parts
[
1
]
+
"!"
,
[
parts
[
0
]]);
var
data
=
this
.
triggerHandler
(
"getData"
+
parts
[
1
]
+
"!"
,
[
parts
[
0
]]);
if
(
data
===
undefined
&&
this
.
length
)
if
(
data
===
undefined
&&
this
.
length
)
{
data
=
jQuery
.
data
(
this
[
0
],
key
);
data
=
jQuery
.
data
(
this
[
0
],
key
);
}
return
data
===
undefined
&&
parts
[
1
]
?
return
data
===
undefined
&&
parts
[
1
]
?
this
.
data
(
parts
[
0
]
)
:
this
.
data
(
parts
[
0
]
)
:
data
;
data
;
}
else
}
else
{
return
this
.
trigger
(
"setData"
+
parts
[
1
]
+
"!"
,
[
parts
[
0
],
value
]).
each
(
function
(){
return
this
.
trigger
(
"setData"
+
parts
[
1
]
+
"!"
,
[
parts
[
0
],
value
]).
each
(
function
(){
jQuery
.
data
(
this
,
key
,
value
);
jQuery
.
data
(
this
,
key
,
value
);
});
});
}
},
},
removeData
:
function
(
key
){
removeData
:
function
(
key
){
...
@@ -149,19 +150,20 @@ jQuery.fn.extend({
...
@@ -149,19 +150,20 @@ jQuery.fn.extend({
type
=
"fx"
;
type
=
"fx"
;
}
}
if
(
data
===
undefined
)
if
(
data
===
undefined
)
{
return
jQuery
.
queue
(
this
[
0
],
type
);
return
jQuery
.
queue
(
this
[
0
],
type
);
}
return
this
.
each
(
function
(
i
,
elem
){
return
this
.
each
(
function
(
i
,
elem
){
var
queue
=
jQuery
.
queue
(
this
,
type
,
data
);
var
queue
=
jQuery
.
queue
(
this
,
type
,
data
);
if
(
type
==
"fx"
&&
queue
[
0
]
!==
"inprogress"
)
if
(
type
==
"fx"
&&
queue
[
0
]
!==
"inprogress"
)
{
jQuery
.
dequeue
(
this
,
type
)
jQuery
.
dequeue
(
this
,
type
);
}
});
});
},
},
dequeue
:
function
(
type
){
dequeue
:
function
(
type
){
return
this
.
each
(
function
(){
return
this
.
each
(
function
(){
jQuery
.
dequeue
(
this
,
type
)
;
jQuery
.
dequeue
(
this
,
type
)
});
});
},
},
clearQueue
:
function
(
type
){
clearQueue
:
function
(
type
){
...
...
src/dimensions.js
View file @
ddb86f8d
...
@@ -20,7 +20,7 @@ jQuery.each([ "Height", "Width" ], function(i, name){
...
@@ -20,7 +20,7 @@ jQuery.each([ "Height", "Width" ], function(i, name){
jQuery
.
fn
[
type
]
=
function
(
size
)
{
jQuery
.
fn
[
type
]
=
function
(
size
)
{
// Get window width or height
// Get window width or height
var
elem
=
this
[
0
];
var
elem
=
this
[
0
];
if
(
!
elem
)
return
null
;
if
(
!
elem
)
{
return
null
;
}
return
(
"scrollTo"
in
elem
&&
elem
.
document
)
?
// does it walk and quack like a window?
return
(
"scrollTo"
in
elem
&&
elem
.
document
)
?
// does it walk and quack like a window?
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
elem
.
document
.
compatMode
===
"CSS1Compat"
&&
elem
.
document
.
documentElement
[
"client"
+
name
]
||
elem
.
document
.
compatMode
===
"CSS1Compat"
&&
elem
.
document
.
documentElement
[
"client"
+
name
]
||
...
...
src/event.js
View file @
ddb86f8d
...
@@ -592,17 +592,19 @@ jQuery.each({
...
@@ -592,17 +592,19 @@ jQuery.each({
event
.
special
[
orig
]
=
{
event
.
special
[
orig
]
=
{
setup
:
function
()
{
setup
:
function
()
{
if
(
this
.
addEventListener
)
if
(
this
.
addEventListener
)
{
this
.
addEventListener
(
orig
,
handle
,
true
);
this
.
addEventListener
(
orig
,
handle
,
true
);
else
}
else
{
event
.
add
(
this
,
fix
,
ieHandler
);
event
.
add
(
this
,
fix
,
ieHandler
);
}
},
},
teardown
:
function
()
{
teardown
:
function
()
{
if
(
this
.
removeEventListener
)
if
(
this
.
removeEventListener
)
{
this
.
removeEventListener
(
orig
,
handle
,
true
);
this
.
removeEventListener
(
orig
,
handle
,
true
);
else
}
else
{
event
.
remove
(
this
,
fix
,
ieHandler
);
event
.
remove
(
this
,
fix
,
ieHandler
);
}
}
}
};
};
});
});
...
@@ -820,7 +822,7 @@ jQuery.extend({
...
@@ -820,7 +822,7 @@ jQuery.extend({
var
readyBound
=
false
;
var
readyBound
=
false
;
function
bindReady
()
{
function
bindReady
()
{
if
(
readyBound
)
return
;
if
(
readyBound
)
{
return
;
}
readyBound
=
true
;
readyBound
=
true
;
// Catch cases where $(document).ready() is called after the
// Catch cases where $(document).ready() is called after the
...
@@ -857,7 +859,8 @@ function bindReady() {
...
@@ -857,7 +859,8 @@ function bindReady() {
toplevel
=
window
.
frameElement
==
null
;
toplevel
=
window
.
frameElement
==
null
;
}
catch
(
e
){}
}
catch
(
e
){}
if
(
document
.
documentElement
.
doScroll
&&
toplevel
)
(
function
()
{
if
(
document
.
documentElement
.
doScroll
&&
toplevel
)
{
(
function
()
{
if
(
jQuery
.
isReady
)
{
if
(
jQuery
.
isReady
)
{
return
;
return
;
}
}
...
@@ -875,6 +878,7 @@ function bindReady() {
...
@@ -875,6 +878,7 @@ function bindReady() {
jQuery
.
ready
();
jQuery
.
ready
();
})();
})();
}
}
}
// A fallback to window.onload, that will always work
// A fallback to window.onload, that will always work
jQuery
.
event
.
add
(
window
,
"load"
,
jQuery
.
ready
);
jQuery
.
event
.
add
(
window
,
"load"
,
jQuery
.
ready
);
...
...
src/fx.js
View file @
ddb86f8d
...
@@ -36,9 +36,9 @@ jQuery.fn.extend({
...
@@ -36,9 +36,9 @@ jQuery.fn.extend({
var
elem
=
jQuery
(
"<"
+
nodeName
+
" />"
).
appendTo
(
"body"
);
var
elem
=
jQuery
(
"<"
+
nodeName
+
" />"
).
appendTo
(
"body"
);
display
=
elem
.
css
(
"display"
);
display
=
elem
.
css
(
"display"
);
if
(
display
===
"none"
)
if
(
display
===
"none"
)
{
display
=
"block"
;
display
=
"block"
;
}
elem
.
remove
();
elem
.
remove
();
elemdisplay
[
nodeName
]
=
display
;
elemdisplay
[
nodeName
]
=
display
;
...
@@ -64,9 +64,10 @@ jQuery.fn.extend({
...
@@ -64,9 +64,10 @@ jQuery.fn.extend({
}
else
{
}
else
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
){
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
){
var
old
=
jQuery
.
data
(
this
[
i
],
"olddisplay"
);
var
old
=
jQuery
.
data
(
this
[
i
],
"olddisplay"
);
if
(
!
old
&&
old
!==
"none"
)
if
(
!
old
&&
old
!==
"none"
)
{
jQuery
.
data
(
this
[
i
],
"olddisplay"
,
jQuery
.
css
(
this
[
i
],
"display"
));
jQuery
.
data
(
this
[
i
],
"olddisplay"
,
jQuery
.
css
(
this
[
i
],
"display"
));
}
}
}
// Set the display of the elements in a second loop
// Set the display of the elements in a second loop
// to avoid the constant reflow
// to avoid the constant reflow
...
@@ -117,9 +118,9 @@ jQuery.fn.extend({
...
@@ -117,9 +118,9 @@ jQuery.fn.extend({
p
=
name
;
p
=
name
;
}
}
if
(
prop
[
p
]
==
"hide"
&&
hidden
||
prop
[
p
]
==
"show"
&&
!
hidden
)
if
(
prop
[
p
]
==
"hide"
&&
hidden
||
prop
[
p
]
==
"show"
&&
!
hidden
)
{
return
opt
.
complete
.
call
(
this
);
return
opt
.
complete
.
call
(
this
);
}
if
(
(
p
==
"height"
||
p
==
"width"
)
&&
this
.
style
)
{
if
(
(
p
==
"height"
||
p
==
"width"
)
&&
this
.
style
)
{
// Store display property
// Store display property
opt
.
display
=
jQuery
.
css
(
this
,
"display"
);
opt
.
display
=
jQuery
.
css
(
this
,
"display"
);
...
@@ -129,17 +130,17 @@ jQuery.fn.extend({
...
@@ -129,17 +130,17 @@ jQuery.fn.extend({
}
}
}
}
if
(
opt
.
overflow
!=
null
)
if
(
opt
.
overflow
!=
null
)
{
this
.
style
.
overflow
=
"hidden"
;
this
.
style
.
overflow
=
"hidden"
;
}
opt
.
curAnim
=
jQuery
.
extend
({},
prop
);
opt
.
curAnim
=
jQuery
.
extend
({},
prop
);
jQuery
.
each
(
prop
,
function
(
name
,
val
){
jQuery
.
each
(
prop
,
function
(
name
,
val
){
var
e
=
new
jQuery
.
fx
(
self
,
opt
,
name
);
var
e
=
new
jQuery
.
fx
(
self
,
opt
,
name
);
if
(
/toggle|show|hide/
.
test
(
val
)
)
if
(
/toggle|show|hide/
.
test
(
val
)
)
{
e
[
val
==
"toggle"
?
hidden
?
"show"
:
"hide"
:
val
](
prop
);
e
[
val
==
"toggle"
?
hidden
?
"show"
:
"hide"
:
val
](
prop
);
else
{
}
else
{
var
parts
=
/^
([
+-
]
=
)?([\d
+-.
]
+
)(
.*
)
$/
.
exec
(
val
),
var
parts
=
/^
([
+-
]
=
)?([\d
+-.
]
+
)(
.*
)
$/
.
exec
(
val
),
start
=
e
.
cur
(
true
)
||
0
;
start
=
e
.
cur
(
true
)
||
0
;
...
@@ -155,13 +156,14 @@ jQuery.fn.extend({
...
@@ -155,13 +156,14 @@ jQuery.fn.extend({
}
}
// If a +=/-= token was provided, we're doing a relative animation
// If a +=/-= token was provided, we're doing a relative animation
if
(
parts
[
1
]
)
if
(
parts
[
1
]
)
{
end
=
((
parts
[
1
]
==
"-="
?
-
1
:
1
)
*
end
)
+
start
;
end
=
((
parts
[
1
]
==
"-="
?
-
1
:
1
)
*
end
)
+
start
;
}
e
.
custom
(
start
,
end
,
unit
);
e
.
custom
(
start
,
end
,
unit
);
}
else
}
else
{
e
.
custom
(
start
,
val
,
""
);
e
.
custom
(
start
,
val
,
""
);
}
}
}
});
});
if
(
jQuery
.
isEmptyObject
(
prop
)
)
{
if
(
jQuery
.
isEmptyObject
(
prop
)
)
{
...
@@ -176,24 +178,26 @@ jQuery.fn.extend({
...
@@ -176,24 +178,26 @@ jQuery.fn.extend({
stop
:
function
(
clearQueue
,
gotoEnd
){
stop
:
function
(
clearQueue
,
gotoEnd
){
var
timers
=
jQuery
.
timers
;
var
timers
=
jQuery
.
timers
;
if
(
clearQueue
)
if
(
clearQueue
)
{
this
.
queue
([]);
this
.
queue
([]);
}
this
.
each
(
function
(){
this
.
each
(
function
(){
// go in reverse order so anything added to the queue during the loop is ignored
// go in reverse order so anything added to the queue during the loop is ignored
for
(
var
i
=
timers
.
length
-
1
;
i
>=
0
;
i
--
)
for
(
var
i
=
timers
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
(
timers
[
i
].
elem
==
this
)
{
if
(
timers
[
i
].
elem
==
this
)
{
if
(
gotoEnd
)
if
(
gotoEnd
)
{
// force the next step to be the last
// force the next step to be the last
timers
[
i
](
true
);
timers
[
i
](
true
);
}
timers
.
splice
(
i
,
1
);
timers
.
splice
(
i
,
1
);
}
}
}
});
});
// start the next in the queue if the last step wasn't forced
// start the next in the queue if the last step wasn't forced
if
(
!
gotoEnd
)
if
(
!
gotoEnd
)
{
this
.
dequeue
();
this
.
dequeue
();
}
return
this
;
return
this
;
}
}
...
@@ -228,10 +232,12 @@ jQuery.extend({
...
@@ -228,10 +232,12 @@ jQuery.extend({
// Queueing
// Queueing
opt
.
old
=
opt
.
complete
;
opt
.
old
=
opt
.
complete
;
opt
.
complete
=
function
(){
opt
.
complete
=
function
(){
if
(
opt
.
queue
!==
false
)
if
(
opt
.
queue
!==
false
)
{
jQuery
(
this
).
dequeue
();
jQuery
(
this
).
dequeue
();
if
(
jQuery
.
isFunction
(
opt
.
old
)
)
}
if
(
jQuery
.
isFunction
(
opt
.
old
)
)
{
opt
.
old
.
call
(
this
);
opt
.
old
.
call
(
this
);
}
};
};
return
opt
;
return
opt
;
...
@@ -253,9 +259,10 @@ jQuery.extend({
...
@@ -253,9 +259,10 @@ jQuery.extend({
this
.
elem
=
elem
;
this
.
elem
=
elem
;
this
.
prop
=
prop
;
this
.
prop
=
prop
;
if
(
!
options
.
orig
)
if
(
!
options
.
orig
)
{
options
.
orig
=
{};
options
.
orig
=
{};
}
}
}
});
});
...
@@ -263,21 +270,22 @@ jQuery.fx.prototype = {
...
@@ -263,21 +270,22 @@ jQuery.fx.prototype = {
// Simple function for setting a style value
// Simple function for setting a style value
update
:
function
(){
update
:
function
(){
if
(
this
.
options
.
step
)
if
(
this
.
options
.
step
)
{
this
.
options
.
step
.
call
(
this
.
elem
,
this
.
now
,
this
);
this
.
options
.
step
.
call
(
this
.
elem
,
this
.
now
,
this
);
}
(
jQuery
.
fx
.
step
[
this
.
prop
]
||
jQuery
.
fx
.
step
.
_default
)(
this
);
(
jQuery
.
fx
.
step
[
this
.
prop
]
||
jQuery
.
fx
.
step
.
_default
)(
this
);
// Set display property to block for height/width animations
// Set display property to block for height/width animations
if
(
(
this
.
prop
==
"height"
||
this
.
prop
==
"width"
)
&&
this
.
elem
.
style
)
if
(
(
this
.
prop
==
"height"
||
this
.
prop
==
"width"
)
&&
this
.
elem
.
style
)
{
this
.
elem
.
style
.
display
=
"block"
;
this
.
elem
.
style
.
display
=
"block"
;
}
},
},
// Get the current size
// Get the current size
cur
:
function
(
force
){
cur
:
function
(
force
){
if
(
this
.
elem
[
this
.
prop
]
!=
null
&&
(
!
this
.
elem
.
style
||
this
.
elem
.
style
[
this
.
prop
]
==
null
)
)
if
(
this
.
elem
[
this
.
prop
]
!=
null
&&
(
!
this
.
elem
.
style
||
this
.
elem
.
style
[
this
.
prop
]
==
null
)
)
{
return
this
.
elem
[
this
.
prop
];
return
this
.
elem
[
this
.
prop
];
}
var
r
=
parseFloat
(
jQuery
.
css
(
this
.
elem
,
this
.
prop
,
force
));
var
r
=
parseFloat
(
jQuery
.
css
(
this
.
elem
,
this
.
prop
,
force
));
return
r
&&
r
>
-
10000
?
r
:
parseFloat
(
jQuery
.
curCSS
(
this
.
elem
,
this
.
prop
))
||
0
;
return
r
&&
r
>
-
10000
?
r
:
parseFloat
(
jQuery
.
curCSS
(
this
.
elem
,
this
.
prop
))
||
0
;
},
},
...
@@ -298,8 +306,9 @@ jQuery.fx.prototype = {
...
@@ -298,8 +306,9 @@ jQuery.fx.prototype = {
t
.
elem
=
this
.
elem
;
t
.
elem
=
this
.
elem
;
if
(
t
()
&&
jQuery
.
timers
.
push
(
t
)
&&
!
timerId
)
if
(
t
()
&&
jQuery
.
timers
.
push
(
t
)
&&
!
timerId
)
{
timerId
=
setInterval
(
jQuery
.
fx
.
tick
,
13
);
timerId
=
setInterval
(
jQuery
.
fx
.
tick
,
13
);
}
},
},
// Simple 'show' function
// Simple 'show' function
...
@@ -339,10 +348,11 @@ jQuery.fx.prototype = {
...
@@ -339,10 +348,11 @@ jQuery.fx.prototype = {
this
.
options
.
curAnim
[
this
.
prop
]
=
true
;
this
.
options
.
curAnim
[
this
.
prop
]
=
true
;
var
done
=
true
;
var
done
=
true
;
for
(
var
i
in
this
.
options
.
curAnim
)
for
(
var
i
in
this
.
options
.
curAnim
)
{
if
(
this
.
options
.
curAnim
[
i
]
!==
true
)
if
(
this
.
options
.
curAnim
[
i
]
!==
true
)
{
done
=
false
;
done
=
false
;
}
}
if
(
done
)
{
if
(
done
)
{
if
(
this
.
options
.
display
!=
null
)
{
if
(
this
.
options
.
display
!=
null
)
{
// Reset the overflow
// Reset the overflow
...
@@ -350,19 +360,21 @@ jQuery.fx.prototype = {
...
@@ -350,19 +360,21 @@ jQuery.fx.prototype = {
// Reset the display
// Reset the display
this
.
elem
.
style
.
display
=
this
.
options
.
display
;
this
.
elem
.
style
.
display
=
this
.
options
.
display
;
if
(
jQuery
.
css
(
this
.
elem
,
"display"
)
==
"none"
)
if
(
jQuery
.
css
(
this
.
elem
,
"display"
)
==
"none"
)
{
this
.
elem
.
style
.
display
=
"block"
;
this
.
elem
.
style
.
display
=
"block"
;
}
}
}
// Hide the element if the "hide" operation was done
// Hide the element if the "hide" operation was done
if
(
this
.
options
.
hide
)
if
(
this
.
options
.
hide
)
{
jQuery
(
this
.
elem
).
hide
();
jQuery
(
this
.
elem
).
hide
();
}
// Reset the properties, if the item has been hidden or shown
// Reset the properties, if the item has been hidden or shown
if
(
this
.
options
.
hide
||
this
.
options
.
show
)
if
(
this
.
options
.
hide
||
this
.
options
.
show
)
{
for
(
var
p
in
this
.
options
.
curAnim
)
for
(
var
p
in
this
.
options
.
curAnim
)
{
jQuery
.
style
(
this
.
elem
,
p
,
this
.
options
.
orig
[
p
]);
jQuery
.
style
(
this
.
elem
,
p
,
this
.
options
.
orig
[
p
]);
}
}
// Execute the complete function
// Execute the complete function
this
.
options
.
complete
.
call
(
this
.
elem
);
this
.
options
.
complete
.
call
(
this
.
elem
);
}
}
...
@@ -390,12 +402,14 @@ jQuery.extend( jQuery.fx, {
...
@@ -390,12 +402,14 @@ jQuery.extend( jQuery.fx, {
tick
:
function
(){
tick
:
function
(){
var
timers
=
jQuery
.
timers
;
var
timers
=
jQuery
.
timers
;
for
(
var
i
=
0
;
i
<
timers
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
timers
.
length
;
i
++
)
{
if
(
!
timers
[
i
]()
)
if
(
!
timers
[
i
]()
)
{
timers
.
splice
(
i
--
,
1
);
timers
.
splice
(
i
--
,
1
);
}
if
(
!
timers
.
length
)
}
if
(
!
timers
.
length
)
{
jQuery
.
fx
.
stop
();
jQuery
.
fx
.
stop
();
}
},
},
stop
:
function
(){
stop
:
function
(){
...
@@ -417,12 +431,13 @@ jQuery.extend( jQuery.fx, {
...
@@ -417,12 +431,13 @@ jQuery.extend( jQuery.fx, {
},
},
_default
:
function
(
fx
){
_default
:
function
(
fx
){
if
(
fx
.
elem
.
style
&&
fx
.
elem
.
style
[
fx
.
prop
]
!=
null
)
if
(
fx
.
elem
.
style
&&
fx
.
elem
.
style
[
fx
.
prop
]
!=
null
)
{
fx
.
elem
.
style
[
fx
.
prop
]
=
fx
.
now
+
fx
.
unit
;
fx
.
elem
.
style
[
fx
.
prop
]
=
fx
.
now
+
fx
.
unit
;
else
}
else
{
fx
.
elem
[
fx
.
prop
]
=
fx
.
now
;
fx
.
elem
[
fx
.
prop
]
=
fx
.
now
;
}
}
}
}
}
});
});
if
(
jQuery
.
expr
&&
jQuery
.
expr
.
filters
)
{
if
(
jQuery
.
expr
&&
jQuery
.
expr
.
filters
)
{
...
...
src/traversing.js
View file @
ddb86f8d
...
@@ -10,8 +10,11 @@ var winnow = function( elements, qualifier, keep ) {
...
@@ -10,8 +10,11 @@ var winnow = function( elements, qualifier, keep ) {
}
else
if
(
typeof
qualifier
===
"string"
)
{
}
else
if
(
typeof
qualifier
===
"string"
)
{
var
filtered
=
jQuery
.
grep
(
elements
,
function
(
elem
)
{
return
elem
.
nodeType
===
1
});
var
filtered
=
jQuery
.
grep
(
elements
,
function
(
elem
)
{
return
elem
.
nodeType
===
1
});
if
(
isSimple
.
test
(
qualifier
))
return
jQuery
.
filter
(
qualifier
,
filtered
,
!
keep
);
if
(
isSimple
.
test
(
qualifier
))
{
else
qualifier
=
jQuery
.
filter
(
qualifier
,
elements
);
return
jQuery
.
filter
(
qualifier
,
filtered
,
!
keep
);
}
else
{
qualifier
=
jQuery
.
filter
(
qualifier
,
elements
);
}
}
}
return
jQuery
.
grep
(
elements
,
function
(
elem
,
i
)
{
return
jQuery
.
grep
(
elements
,
function
(
elem
,
i
)
{
...
...
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