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
328ba956
Commit
328ba956
authored
Feb 25, 2013
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No ticket: reduce support.js
parent
44340c88
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
52 deletions
+49
-52
support.js
src/support.js
+49
-52
No files found.
src/support.js
View file @
328ba956
jQuery
.
support
=
(
function
()
{
jQuery
.
support
=
(
function
(
support
)
{
var
support
,
all
,
a
,
var
all
,
a
,
input
,
select
,
fragment
,
opt
,
eventName
,
isSupported
,
i
,
input
,
select
,
fragment
,
opt
,
eventName
,
isSupported
,
i
,
div
=
document
.
createElement
(
"div"
);
div
=
document
.
createElement
(
"div"
);
// Setup
// Setup
div
.
setAttribute
(
"className"
,
"t"
);
div
.
setAttribute
(
"className"
,
"t"
);
div
.
innerHTML
=
" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"
;
div
.
innerHTML
=
" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"
;
//
Support tests won't run in some limited or non-browser
environments
//
Finish early in limited (non-browser)
environments
all
=
div
.
getElementsByTagName
(
"*"
);
all
=
div
.
getElementsByTagName
(
"*"
);
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
if
(
!
all
||
!
a
||
!
all
.
length
)
{
if
(
!
all
||
!
a
||
!
all
.
length
)
{
return
{}
;
return
support
;
}
}
// First batch of tests
// First batch of tests
...
@@ -22,64 +20,63 @@ jQuery.support = (function() {
...
@@ -22,64 +20,63 @@ jQuery.support = (function() {
input
=
div
.
getElementsByTagName
(
"input"
)[
0
];
input
=
div
.
getElementsByTagName
(
"input"
)[
0
];
a
.
style
.
cssText
=
"top:1px;float:left;opacity:.5"
;
a
.
style
.
cssText
=
"top:1px;float:left;opacity:.5"
;
support
=
{
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute
:
div
.
className
!==
"t"
,
support
.
getSetAttribute
=
div
.
className
!==
"t"
;
// IE strips leading whitespace when .innerHTML is used
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace
:
div
.
firstChild
.
nodeType
===
3
,
support
.
leadingWhitespace
=
div
.
firstChild
.
nodeType
===
3
;
// Make sure that tbody elements aren't automatically inserted
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
// IE will insert them into empty tables
tbody
:
!
div
.
getElementsByTagName
(
"tbody"
).
length
,
support
.
tbody
=
!
div
.
getElementsByTagName
(
"tbody"
).
length
;
// Make sure that link elements get serialized correctly by innerHTML
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
// This requires a wrapper element in IE
htmlSerialize
:
!!
div
.
getElementsByTagName
(
"link"
).
length
,
support
.
htmlSerialize
=
!!
div
.
getElementsByTagName
(
"link"
).
length
;
// Get the style information from getAttribute
// Get the style information from getAttribute
// (IE uses .cssText instead)
// (IE uses .cssText instead)
style
:
/top/
.
test
(
a
.
getAttribute
(
"style"
)
),
support
.
style
=
/top/
.
test
(
a
.
getAttribute
(
"style"
)
);
// Make sure that URLs aren't manipulated
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
// (IE normalizes it by default)
hrefNormalized
:
a
.
getAttribute
(
"href"
)
===
"/a"
,
support
.
hrefNormalized
=
a
.
getAttribute
(
"href"
)
===
"/a"
;
// Make sure that element opacity exists
// Make sure that element opacity exists
// (IE uses filter instead)
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
// Use a regex to work around a WebKit issue. See #5145
opacity
:
/^0.5/
.
test
(
a
.
style
.
opacity
),
support
.
opacity
=
/^0.5/
.
test
(
a
.
style
.
opacity
);
// Verify style float existence
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
// (IE uses styleFloat instead of cssFloat)
cssFloat
:
!!
a
.
style
.
cssFloat
,
support
.
cssFloat
=
!!
a
.
style
.
cssFloat
;
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
checkOn
:
!!
input
.
value
,
support
.
checkOn
=
!!
input
.
value
;
// Make sure that a selected-by-default option has a working selected property.
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected
:
opt
.
selected
,
support
.
optSelected
=
opt
.
selected
;
// Tests for enctype support on a form (#6743)
// Tests for enctype support on a form (#6743)
enctype
:
!!
document
.
createElement
(
"form"
).
enctype
,
support
.
enctype
=
!!
document
.
createElement
(
"form"
).
enctype
;
// Makes sure cloning an html5 element does not cause problems
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
// Where outerHTML is undefined, this still works
html5Clone
:
document
.
createElement
(
"nav"
).
cloneNode
(
true
).
outerHTML
!==
"<:nav></:nav>"
,
support
.
html5Clone
=
document
.
createElement
(
"nav"
).
cloneNode
(
true
).
outerHTML
!==
"<:nav></:nav>"
;
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel
:
document
.
compatMode
===
"CSS1Compat"
,
support
.
boxModel
=
document
.
compatMode
===
"CSS1Compat"
;
// Will be defined later
// Will be defined later
deleteExpando
:
true
,
support
.
inlineBlockNeedsLayout
=
false
;
noCloneEvent
:
true
,
support
.
shrinkWrapBlocks
=
false
;
inlineBlockNeedsLayout
:
false
,
support
.
pixelPosition
=
false
;
shrinkWrapBlocks
:
false
,
support
.
deleteExpando
=
true
;
reliableMarginRight
:
true
,
support
.
noCloneEvent
=
true
;
boxSizingReliable
:
true
,
support
.
reliableMarginRight
=
true
;
pixelPosition
:
false
support
.
boxSizingReliable
=
true
;
};
// Make sure checked status is properly cloned
// Make sure checked status is properly cloned
input
.
checked
=
true
;
input
.
checked
=
true
;
...
@@ -237,5 +234,5 @@ jQuery.support = (function() {
...
@@ -237,5 +234,5 @@ jQuery.support = (function() {
all
=
select
=
fragment
=
opt
=
a
=
input
=
null
;
all
=
select
=
fragment
=
opt
=
a
=
input
=
null
;
return
support
;
return
support
;
})();
})(
{}
);
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