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
8f01b92b
Commit
8f01b92b
authored
Jul 10, 2012
by
Mike Sherov
Committed by
Dave Methvin
Jul 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow the style guide, lose 72 bytes! Closes gh-840.
parent
f30f7732
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
147 additions
and
135 deletions
+147
-135
ajax.js
src/ajax.js
+39
-42
xhr.js
src/ajax/xhr.js
+5
-6
attributes.js
src/attributes.js
+5
-4
callbacks.js
src/callbacks.js
+5
-5
core.js
src/core.js
+31
-21
css.js
src/css.js
+8
-15
data.js
src/data.js
+2
-1
dimensions.js
src/dimensions.js
+5
-8
effects.js
src/effects.js
+2
-2
event.js
src/event.js
+15
-14
manipulation.js
src/manipulation.js
+16
-7
traversing.js
src/traversing.js
+14
-10
No files found.
src/ajax.js
View file @
8f01b92b
var
r20
=
/%20/g
,
var
// Document location
ajaxLocation
,
// Document location segments
ajaxLocParts
,
r20
=
/%20/g
,
rbracket
=
/
\[\]
$/
,
rCRLF
=
/
\r?\n
/g
,
rhash
=
/#.*$/
,
...
...
@@ -35,12 +40,6 @@ var r20 = /%20/g,
*/
transports
=
{},
// Document location
ajaxLocation
,
// Document location segments
ajaxLocParts
,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes
=
[
"*/"
]
+
[
"*"
];
...
...
@@ -70,14 +69,12 @@ function addToPrefiltersOrTransports( structure ) {
dataTypeExpression
=
"*"
;
}
if
(
jQuery
.
isFunction
(
func
)
)
{
var
dataTypes
=
dataTypeExpression
.
toLowerCase
().
split
(
core_rspace
),
i
=
0
,
length
=
dataTypes
.
length
,
dataType
,
list
,
placeBefore
;
var
dataType
,
list
,
placeBefore
,
dataTypes
=
dataTypeExpression
.
toLowerCase
().
split
(
core_rspace
),
i
=
0
,
length
=
dataTypes
.
length
;
if
(
jQuery
.
isFunction
(
func
)
)
{
// For each dataType in the dataTypeExpression
for
(
;
i
<
length
;
i
++
)
{
dataType
=
dataTypes
[
i
];
...
...
@@ -104,11 +101,11 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
inspected
[
dataType
]
=
true
;
var
list
=
structure
[
dataType
],
var
selection
,
list
=
structure
[
dataType
],
i
=
0
,
length
=
list
?
list
.
length
:
0
,
executeOnly
=
(
structure
===
prefilters
),
selection
;
executeOnly
=
(
structure
===
prefilters
);
for
(
;
i
<
length
&&
(
executeOnly
||
!
selection
);
i
++
)
{
selection
=
list
[
i
](
options
,
originalOptions
,
jqXHR
);
...
...
@@ -383,7 +380,22 @@ jQuery.extend({
// Force options to be an object
options
=
options
||
{};
var
// Create the final options object
var
// ifModified key
ifModifiedKey
,
// Response headers
responseHeadersString
,
responseHeaders
,
// transport
transport
,
// timeout handle
timeoutTimer
,
// Cross-domain detection vars
parts
,
// To know if global events are to be dispatched
fireGlobals
,
// Loop variable
i
,
// Create the final options object
s
=
jQuery
.
ajaxSetup
(
{},
options
),
// Callbacks context
callbackContext
=
s
.
context
||
s
,
...
...
@@ -398,26 +410,11 @@ jQuery.extend({
completeDeferred
=
jQuery
.
Callbacks
(
"once memory"
),
// Status-dependent callbacks
statusCode
=
s
.
statusCode
||
{},
// ifModified key
ifModifiedKey
,
// Headers (they are sent all at once)
requestHeaders
=
{},
requestHeadersNames
=
{},
// Response headers
responseHeadersString
,
responseHeaders
,
// transport
transport
,
// timeout handle
timeoutTimer
,
// Cross-domain detection vars
parts
,
// The jqXHR state
state
=
0
,
// To know if global events are to be dispatched
fireGlobals
,
// Loop variable
i
,
// Default abort message
strAbort
=
"canceled"
,
// Fake xhr
...
...
@@ -759,7 +756,8 @@ jQuery.extend({
// Serialize an array of form elements or a set of
// key/values into a query string
param
:
function
(
a
,
traditional
)
{
var
s
=
[],
var
prefix
,
s
=
[],
add
=
function
(
key
,
value
)
{
// If value is a function, invoke it and return its value
value
=
jQuery
.
isFunction
(
value
)
?
value
()
:
(
value
==
null
?
""
:
value
);
...
...
@@ -781,7 +779,7 @@ jQuery.extend({
}
else
{
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for
(
var
prefix
in
a
)
{
for
(
prefix
in
a
)
{
buildParams
(
prefix
,
a
[
prefix
],
traditional
,
add
);
}
}
...
...
@@ -792,6 +790,8 @@ jQuery.extend({
});
function
buildParams
(
prefix
,
obj
,
traditional
,
add
)
{
var
name
;
if
(
jQuery
.
isArray
(
obj
)
)
{
// Serialize array item.
jQuery
.
each
(
obj
,
function
(
i
,
v
)
{
...
...
@@ -813,7 +813,7 @@ function buildParams( prefix, obj, traditional, add ) {
}
else
if
(
!
traditional
&&
jQuery
.
type
(
obj
)
===
"object"
)
{
// Serialize object item.
for
(
var
name
in
obj
)
{
for
(
name
in
obj
)
{
buildParams
(
prefix
+
"["
+
name
+
"]"
,
obj
[
name
],
traditional
,
add
);
}
...
...
@@ -843,13 +843,10 @@ jQuery.extend({
*/
function
ajaxHandleResponses
(
s
,
jqXHR
,
responses
)
{
var
contents
=
s
.
contents
,
var
ct
,
type
,
finalDataType
,
firstDataType
,
contents
=
s
.
contents
,
dataTypes
=
s
.
dataTypes
,
responseFields
=
s
.
responseFields
,
ct
,
type
,
finalDataType
,
firstDataType
;
responseFields
=
s
.
responseFields
;
// Fill responseXXX fields
for
(
type
in
responseFields
)
{
...
...
src/ajax/xhr.js
View file @
8f01b92b
var
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
var
xhrCallbacks
,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort
=
window
.
ActiveXObject
?
function
()
{
// Abort all pending requests
for
(
var
key
in
xhrCallbacks
)
{
xhrCallbacks
[
key
](
0
,
1
);
}
}
:
false
,
xhrId
=
0
,
xhrCallbacks
;
xhrId
=
0
;
// Functions to create xhrs
function
createStandardXHR
()
{
...
...
@@ -57,9 +57,8 @@ if ( jQuery.support.ajax ) {
send
:
function
(
headers
,
complete
)
{
// Get a new xhr
var
xhr
=
s
.
xhr
(),
handle
,
i
;
var
handle
,
i
,
xhr
=
s
.
xhr
();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
...
...
src/attributes.js
View file @
8f01b92b
var
rclass
=
/
[\n\t\r]
/g
,
var
nodeHook
,
boolHook
,
fixSpecified
,
rclass
=
/
[\n\t\r]
/g
,
rreturn
=
/
\r
/g
,
rtype
=
/^
(?:
button|input
)
$/i
,
rfocusable
=
/^
(?:
button|input|object|select|textarea
)
$/i
,
rclickable
=
/^a
(?:
rea
)?
$/i
,
rboolean
=
/^
(?:
autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected
)
$/i
,
getSetAttribute
=
jQuery
.
support
.
getSetAttribute
,
nodeHook
,
boolHook
,
fixSpecified
;
getSetAttribute
=
jQuery
.
support
.
getSetAttribute
;
jQuery
.
fn
.
extend
({
attr
:
function
(
name
,
value
)
{
...
...
@@ -179,7 +179,8 @@ jQuery.fn.extend({
isFunction
=
jQuery
.
isFunction
(
value
);
return
this
.
each
(
function
(
i
)
{
var
self
=
jQuery
(
this
),
val
;
var
val
,
self
=
jQuery
(
this
);
if
(
this
.
nodeType
!==
1
)
{
return
;
...
...
src/callbacks.js
View file @
8f01b92b
...
...
@@ -40,11 +40,7 @@ jQuery.Callbacks = function( options ) {
(
optionsCache
[
options
]
||
createOptions
(
options
)
)
:
jQuery
.
extend
(
{},
options
);
var
// Actual callback list
list
=
[],
// Stack of fire calls for repeatable lists
stack
=
!
options
.
once
&&
[],
// Last fire value (for non-forgettable lists)
var
// Last fire value (for non-forgettable lists)
memory
,
// Flag to know if list was already fired
fired
,
...
...
@@ -56,6 +52,10 @@ jQuery.Callbacks = function( options ) {
firingLength
,
// Index of currently firing callback (modified by remove if needed)
firingIndex
,
// Actual callback list
list
=
[],
// Stack of fire calls for repeatable lists
stack
=
!
options
.
once
&&
[],
// Fire callbacks
fire
=
function
(
data
)
{
memory
=
options
.
memory
&&
data
;
...
...
src/core.js
View file @
8f01b92b
var
// A central reference to the root jQuery(document)
rootjQuery
,
// The deferred used on DOM ready
readyList
,
// Use the correct document accordingly with window argument (sandbox)
document
=
window
.
document
,
location
=
window
.
location
,
...
...
@@ -24,12 +30,6 @@ var
return
new
jQuery
.
fn
.
init
(
selector
,
context
,
rootjQuery
);
},
// A central reference to the root jQuery(document)
rootjQuery
,
// The deferred used on DOM ready
readyList
,
// Used for detecting and trimming whitespace
core_rnotwhite
=
/
\S
/
,
core_rspace
=
/
\s
+/
,
...
...
@@ -449,7 +449,8 @@ jQuery.extend({
},
isEmptyObject
:
function
(
obj
)
{
for
(
var
name
in
obj
)
{
var
name
;
for
(
name
in
obj
)
{
return
false
;
}
return
true
;
...
...
@@ -560,7 +561,8 @@ jQuery.extend({
// args is for internal usage only
each
:
function
(
obj
,
callback
,
args
)
{
var
name
,
i
=
0
,
var
name
,
i
=
0
,
length
=
obj
.
length
,
isObj
=
length
===
undefined
||
jQuery
.
isFunction
(
obj
);
...
...
@@ -616,12 +618,13 @@ jQuery.extend({
// results is for internal usage only
makeArray
:
function
(
arr
,
results
)
{
var
ret
=
results
||
[];
var
type
,
ret
=
results
||
[];
if
(
arr
!=
null
)
{
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var
type
=
jQuery
.
type
(
arr
);
type
=
jQuery
.
type
(
arr
);
if
(
arr
.
length
==
null
||
type
===
"string"
||
type
===
"function"
||
type
===
"regexp"
||
jQuery
.
isWindow
(
arr
)
)
{
core_push
.
call
(
ret
,
arr
);
...
...
@@ -656,11 +659,12 @@ jQuery.extend({
},
merge
:
function
(
first
,
second
)
{
var
i
=
first
.
length
,
var
l
=
second
.
length
,
i
=
first
.
length
,
j
=
0
;
if
(
typeof
second
.
length
===
"number"
)
{
for
(
var
l
=
second
.
length
;
j
<
l
;
j
++
)
{
if
(
typeof
l
===
"number"
)
{
for
(
;
j
<
l
;
j
++
)
{
first
[
i
++
]
=
second
[
j
];
}
...
...
@@ -676,12 +680,15 @@ jQuery.extend({
},
grep
:
function
(
elems
,
callback
,
inv
)
{
var
ret
=
[],
retVal
;
var
retVal
,
ret
=
[],
i
=
0
,
length
=
elems
.
length
;
inv
=
!!
inv
;
// Go through the array, only saving the items
// that pass the validator function
for
(
var
i
=
0
,
length
=
elems
.
length
;
i
<
length
;
i
++
)
{
for
(
;
i
<
length
;
i
++
)
{
retVal
=
!!
callback
(
elems
[
i
],
i
);
if
(
inv
!==
retVal
)
{
ret
.
push
(
elems
[
i
]
);
...
...
@@ -693,7 +700,8 @@ jQuery.extend({
// arg is for internal usage only
map
:
function
(
elems
,
callback
,
arg
)
{
var
value
,
key
,
ret
=
[],
var
value
,
key
,
ret
=
[],
i
=
0
,
length
=
elems
.
length
,
// jquery objects are treated as arrays
...
...
@@ -730,8 +738,10 @@ jQuery.extend({
// Bind a function to a context, optionally partially applying any
// arguments.
proxy
:
function
(
fn
,
context
)
{
var
tmp
,
args
,
proxy
;
if
(
typeof
context
===
"string"
)
{
var
tmp
=
fn
[
context
];
tmp
=
fn
[
context
];
context
=
fn
;
fn
=
tmp
;
}
...
...
@@ -743,10 +753,10 @@ jQuery.extend({
}
// Simulated bind
var
args
=
core_slice
.
call
(
arguments
,
2
),
proxy
=
function
()
{
return
fn
.
apply
(
context
,
args
.
concat
(
core_slice
.
call
(
arguments
)
)
);
};
args
=
core_slice
.
call
(
arguments
,
2
);
proxy
=
function
()
{
return
fn
.
apply
(
context
,
args
.
concat
(
core_slice
.
call
(
arguments
)
)
);
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy
.
guid
=
fn
.
guid
=
fn
.
guid
||
proxy
.
guid
||
jQuery
.
guid
++
;
...
...
src/css.js
View file @
8f01b92b
// order is important!
jQuery
.
cssExpand
=
[
"Top"
,
"Right"
,
"Bottom"
,
"Left"
];
var
curCSS
,
iframe
,
iframeDoc
,
ralpha
=
/alpha
\([^
)
]
*
\)
/i
,
ropacity
=
/opacity=
([^
)
]
*
)
/
,
...
...
@@ -11,7 +8,8 @@ var curCSS, iframe, iframeDoc,
elemdisplay
=
{},
cssShow
=
{
position
:
"absolute"
,
visibility
:
"hidden"
,
display
:
"block"
},
cssExpand
=
jQuery
.
cssExpand
,
// order is important!
cssExpand
=
[
"Top"
,
"Right"
,
"Bottom"
,
"Left"
],
cssPrefixes
=
[
"Webkit"
,
"O"
,
"Moz"
,
"ms"
],
rposition
=
/^
(
top|right|bottom|left
)
$/
,
...
...
@@ -254,8 +252,8 @@ jQuery.extend({
// A method for quickly swapping in/out CSS properties to get correct calculations
swap
:
function
(
elem
,
options
,
callback
)
{
var
old
=
{}
,
ret
,
name
;
var
ret
,
name
,
old
=
{}
;
// Remember the old values, and insert the new ones
for
(
name
in
options
)
{
...
...
@@ -304,14 +302,14 @@ if ( window.getComputedStyle ) {
};
}
else
if
(
document
.
documentElement
.
currentStyle
)
{
curCSS
=
function
(
elem
,
name
)
{
var
left
,
rsLeft
,
uncomputed
,
var
left
,
rsLeft
,
ret
=
elem
.
currentStyle
&&
elem
.
currentStyle
[
name
],
style
=
elem
.
style
;
// Avoid setting ret to empty string here
// so we don't default to auto
if
(
ret
==
null
&&
style
&&
(
uncomputed
=
style
[
name
])
)
{
ret
=
uncomputed
;
if
(
ret
==
null
&&
style
&&
style
[
name
]
)
{
ret
=
style
[
name
]
;
}
// From the awesome hack by Dean Edwards
...
...
@@ -555,8 +553,6 @@ jQuery(function() {
return
jQuery
.
swap
(
elem
,
{
"display"
:
"inline-block"
},
function
()
{
if
(
computed
)
{
return
curCSS
(
elem
,
"marginRight"
);
}
else
{
return
elem
.
style
.
marginRight
;
}
});
}
...
...
@@ -584,10 +580,7 @@ jQuery(function() {
if
(
jQuery
.
expr
&&
jQuery
.
expr
.
filters
)
{
jQuery
.
expr
.
filters
.
hidden
=
function
(
elem
)
{
var
width
=
elem
.
offsetWidth
,
height
=
elem
.
offsetHeight
;
return
(
width
===
0
&&
height
===
0
)
||
(
!
jQuery
.
support
.
reliableHiddenOffsets
&&
((
elem
.
style
&&
elem
.
style
.
display
)
||
jQuery
.
css
(
elem
,
"display"
))
===
"none"
);
return
(
elem
.
offsetWidth
===
0
&&
elem
.
offsetHeight
===
0
)
||
(
!
jQuery
.
support
.
reliableHiddenOffsets
&&
((
elem
.
style
&&
elem
.
style
.
display
)
||
curCSS
(
elem
,
"display"
))
===
"none"
);
};
jQuery
.
expr
.
filters
.
visible
=
function
(
elem
)
{
...
...
src/data.js
View file @
8f01b92b
...
...
@@ -322,7 +322,8 @@ function dataAttr( elem, key, data ) {
// checks a cache object for emptiness
function
isEmptyDataObject
(
obj
)
{
for
(
var
name
in
obj
)
{
var
name
;
for
(
name
in
obj
)
{
// if the public data object is empty, the private is still empty
if
(
name
===
"data"
&&
jQuery
.
isEmptyObject
(
obj
[
name
]
)
)
{
...
...
src/dimensions.js
View file @
8f01b92b
...
...
@@ -3,10 +3,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery
.
each
(
{
padding
:
"inner"
+
name
,
content
:
type
,
""
:
"outer"
+
name
},
function
(
defaultExtra
,
funcName
)
{
// margin is only for outerHeight, outerWidth
jQuery
.
fn
[
funcName
]
=
function
(
margin
,
value
)
{
var
clientProp
=
"client"
+
name
,
scrollProp
=
"scroll"
+
name
,
offsetProp
=
"offset"
+
name
,
chainable
=
arguments
.
length
&&
(
defaultExtra
||
typeof
margin
!==
"boolean"
),
var
chainable
=
arguments
.
length
&&
(
defaultExtra
||
typeof
margin
!==
"boolean"
),
extra
=
defaultExtra
||
(
margin
===
true
||
value
===
true
?
"margin"
:
"border"
);
return
jQuery
.
access
(
this
,
function
(
elem
,
type
,
value
)
{
...
...
@@ -16,7 +13,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return
elem
.
document
.
documentElement
[
clientProp
];
return
elem
.
document
.
documentElement
[
"client"
+
name
];
}
// Get document width or height
...
...
@@ -26,9 +23,9 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return
Math
.
max
(
elem
.
body
[
scrollProp
],
doc
[
scrollProp
],
elem
.
body
[
offsetProp
],
doc
[
offsetProp
],
doc
[
clientProp
]
elem
.
body
[
"scroll"
+
name
],
doc
[
"scroll"
+
name
],
elem
.
body
[
"offset"
+
name
],
doc
[
"offset"
+
name
],
doc
[
"client"
+
name
]
);
}
...
...
src/effects.js
View file @
8f01b92b
...
...
@@ -428,7 +428,7 @@ Tween.propHooks = {
function
isHidden
(
elem
,
el
)
{
elem
=
el
||
elem
;
return
jQuery
.
css
(
elem
,
"display"
)
===
"none"
||
!
jQuery
.
contains
(
elem
.
ownerDocument
.
documentElement
,
elem
);
return
curCSS
(
elem
,
"display"
)
===
"none"
||
!
jQuery
.
contains
(
elem
.
ownerDocument
.
documentElement
,
elem
);
}
jQuery
.
each
([
"toggle"
,
"show"
,
"hide"
],
function
(
i
,
name
)
{
...
...
@@ -529,7 +529,7 @@ function genFx( type, includeWidth ) {
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
for
(
;
i
<
4
;
i
+=
2
-
includeWidth
)
{
which
=
jQuery
.
cssExpand
[
i
];
which
=
cssExpand
[
i
];
attrs
[
"margin"
+
which
]
=
attrs
[
"padding"
+
which
]
=
type
;
}
...
...
src/event.js
View file @
8f01b92b
...
...
@@ -130,9 +130,9 @@ jQuery.event = {
// Detach an event or set of events from an element
remove
:
function
(
elem
,
types
,
handler
,
selector
,
mappedTypes
)
{
var
elemData
=
jQuery
.
hasData
(
elem
)
&&
jQuery
.
_data
(
elem
)
,
t
,
tns
,
type
,
origType
,
namespaces
,
origCount
,
j
,
events
,
special
,
eventType
,
handleObj
;
var
t
,
tns
,
type
,
origType
,
namespaces
,
origCount
,
j
,
events
,
special
,
eventType
,
handleObj
,
elemData
=
jQuery
.
hasData
(
elem
)
&&
jQuery
.
_data
(
elem
)
;
if
(
!
elemData
||
!
(
events
=
elemData
.
events
)
)
{
return
;
...
...
@@ -214,9 +214,9 @@ jQuery.event = {
}
// Event object or event type
var
type
=
event
.
type
||
event
,
namespaces
=
[]
,
cache
,
exclusive
,
i
,
cur
,
old
,
ontype
,
special
,
handle
,
eventPath
,
bubbleType
;
var
cache
,
exclusive
,
i
,
cur
,
old
,
ontype
,
special
,
handle
,
eventPath
,
bubbleType
,
type
=
event
.
type
||
event
,
namespaces
=
[]
;
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if
(
rfocusMorph
.
test
(
type
+
jQuery
.
event
.
triggered
)
)
{
...
...
@@ -361,13 +361,13 @@ jQuery.event = {
// Make a writable jQuery.Event from the native event object
event
=
jQuery
.
event
.
fix
(
event
||
window
.
event
);
var
handlers
=
(
(
jQuery
.
_data
(
this
,
"events"
)
||
{}
)[
event
.
type
]
||
[]),
var
i
,
j
,
cur
,
jqcur
,
ret
,
selMatch
,
matched
,
matches
,
handleObj
,
sel
,
related
,
handlers
=
(
(
jQuery
.
_data
(
this
,
"events"
)
||
{}
)[
event
.
type
]
||
[]),
delegateCount
=
handlers
.
delegateCount
,
args
=
[].
slice
.
call
(
arguments
),
run_all
=
!
event
.
exclusive
&&
!
event
.
namespace
,
special
=
jQuery
.
event
.
special
[
event
.
type
]
||
{},
handlerQueue
=
[],
i
,
j
,
cur
,
jqcur
,
ret
,
selMatch
,
matched
,
matches
,
handleObj
,
sel
,
related
;
handlerQueue
=
[];
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args
[
0
]
=
event
;
...
...
@@ -713,11 +713,11 @@ jQuery.each({
bindType
:
fix
,
handle
:
function
(
event
)
{
var
target
=
this
,
var
ret
,
target
=
this
,
related
=
event
.
relatedTarget
,
handleObj
=
event
.
handleObj
,
selector
=
handleObj
.
selector
,
ret
;
selector
=
handleObj
.
selector
;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
...
...
@@ -921,9 +921,10 @@ jQuery.fn.extend({
return
this
.
on
(
types
,
selector
,
data
,
fn
,
1
);
},
off
:
function
(
types
,
selector
,
fn
)
{
var
handleObj
,
type
;
if
(
types
&&
types
.
preventDefault
&&
types
.
handleObj
)
{
// ( event ) dispatched jQuery.Event
var
handleObj
=
types
.
handleObj
;
handleObj
=
types
.
handleObj
;
jQuery
(
types
.
delegateTarget
).
off
(
handleObj
.
namespace
?
handleObj
.
origType
+
"."
+
handleObj
.
namespace
:
handleObj
.
origType
,
handleObj
.
selector
,
...
...
@@ -933,7 +934,7 @@ jQuery.fn.extend({
}
if
(
typeof
types
===
"object"
)
{
// ( types-object [, selector] )
for
(
var
type
in
types
)
{
for
(
type
in
types
)
{
this
.
off
(
type
,
selector
,
types
[
type
]
);
}
return
this
;
...
...
src/manipulation.js
View file @
8f01b92b
...
...
@@ -169,7 +169,10 @@ jQuery.fn.extend({
// keepData is for internal use only--do not document
remove
:
function
(
selector
,
keepData
)
{
for
(
var
i
=
0
,
elem
;
(
elem
=
this
[
i
])
!=
null
;
i
++
)
{
var
elem
,
i
=
0
;
for
(
;
(
elem
=
this
[
i
])
!=
null
;
i
++
)
{
if
(
!
selector
||
jQuery
.
filter
(
selector
,
[
elem
]
).
length
)
{
if
(
!
keepData
&&
elem
.
nodeType
===
1
)
{
jQuery
.
cleanData
(
elem
.
getElementsByTagName
(
"*"
)
);
...
...
@@ -186,7 +189,10 @@ jQuery.fn.extend({
},
empty
:
function
()
{
for
(
var
i
=
0
,
elem
;
(
elem
=
this
[
i
])
!=
null
;
i
++
)
{
var
elem
,
i
=
0
;
for
(
;
(
elem
=
this
[
i
])
!=
null
;
i
++
)
{
// Remove element nodes and prevent memory leaks
if
(
elem
.
nodeType
===
1
)
{
jQuery
.
cleanData
(
elem
.
getElementsByTagName
(
"*"
)
);
...
...
@@ -480,7 +486,7 @@ function cloneFixAttributes( src, dest ) {
jQuery
.
buildFragment
=
function
(
args
,
context
,
scripts
)
{
var
fragment
,
cacheable
,
cachehit
,
first
=
args
[
0
];
first
=
args
[
0
];
// Set context from what may come in as undefined or a jQuery collection or a node
context
=
context
||
document
;
...
...
@@ -533,16 +539,19 @@ jQuery.each({
replaceAll
:
"replaceWith"
},
function
(
name
,
original
)
{
jQuery
.
fn
[
name
]
=
function
(
selector
)
{
var
ret
=
[],
var
elems
,
i
=
0
,
ret
=
[],
insert
=
jQuery
(
selector
),
l
=
insert
.
length
,
parent
=
this
.
length
===
1
&&
this
[
0
].
parentNode
;
if
(
(
parent
==
null
||
parent
&&
parent
.
nodeType
===
11
&&
parent
.
childNodes
.
length
===
1
)
&&
insert
.
length
===
1
)
{
if
(
(
parent
==
null
||
parent
&&
parent
.
nodeType
===
11
&&
parent
.
childNodes
.
length
===
1
)
&&
l
===
1
)
{
insert
[
original
](
this
[
0
]
);
return
this
;
}
else
{
for
(
var
i
=
0
,
l
=
insert
.
length
;
i
<
l
;
i
++
)
{
var
elems
=
(
i
>
0
?
this
.
clone
(
true
)
:
this
).
get
();
for
(
;
i
<
l
;
i
++
)
{
elems
=
(
i
>
0
?
this
.
clone
(
true
)
:
this
).
get
();
jQuery
(
insert
[
i
]
)[
original
](
elems
);
ret
=
ret
.
concat
(
elems
);
}
...
...
src/traversing.js
View file @
8f01b92b
...
...
@@ -12,8 +12,8 @@ var runtil = /Until$/,
jQuery
.
fn
.
extend
({
find
:
function
(
selector
)
{
var
self
=
this
,
i
,
l
;
var
i
,
l
,
length
,
n
,
r
,
ret
,
self
=
this
;
if
(
typeof
selector
!==
"string"
)
{
return
jQuery
(
selector
).
filter
(
function
()
{
...
...
@@ -25,8 +25,7 @@ jQuery.fn.extend({
});
}
var
ret
=
this
.
pushStack
(
""
,
"find"
,
selector
),
length
,
n
,
r
;
ret
=
this
.
pushStack
(
""
,
"find"
,
selector
);
for
(
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
length
=
ret
.
length
;
...
...
@@ -49,9 +48,12 @@ jQuery.fn.extend({
},
has
:
function
(
target
)
{
var
targets
=
jQuery
(
target
,
this
);
var
i
=
0
,
targets
=
jQuery
(
target
,
this
),
l
=
targets
.
length
;
return
this
.
filter
(
function
()
{
for
(
var
i
=
0
,
l
=
targets
.
length
;
i
<
l
;
i
++
)
{
for
(
;
i
<
l
;
i
++
)
{
if
(
jQuery
.
contains
(
this
,
targets
[
i
]
)
)
{
return
true
;
}
...
...
@@ -79,13 +81,15 @@ jQuery.fn.extend({
},
closest
:
function
(
selectors
,
context
)
{
var
ret
=
[],
i
,
l
,
cur
;
var
pos
=
POS
.
test
(
selectors
)
||
typeof
selectors
!==
"string"
?
var
cur
,
i
=
0
,
l
=
this
.
length
,
ret
=
[],
pos
=
POS
.
test
(
selectors
)
||
typeof
selectors
!==
"string"
?
jQuery
(
selectors
,
context
||
this
.
context
)
:
0
;
for
(
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
for
(
;
i
<
l
;
i
++
)
{
cur
=
this
[
i
];
while
(
cur
)
{
...
...
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