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
Hide 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
,
input
,
select
,
fragment
,
opt
,
eventName
,
isSupported
,
i
,
var
all
,
a
,
input
,
select
,
fragment
,
opt
,
eventName
,
isSupported
,
i
,
div
=
document
.
createElement
(
"div"
);
// Setup
div
.
setAttribute
(
"className"
,
"t"
);
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
(
"*"
);
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
if
(
!
all
||
!
a
||
!
all
.
length
)
{
return
{}
;
return
support
;
}
// First batch of tests
...
...
@@ -22,64 +20,63 @@ jQuery.support = (function() {
input
=
div
.
getElementsByTagName
(
"input"
)[
0
];
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)
getSetAttribute
:
div
.
className
!==
"t"
,
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace
:
div
.
firstChild
.
nodeType
===
3
,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support
.
getSetAttribute
=
div
.
className
!==
"t"
;
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody
:
!
div
.
getElementsByTagName
(
"tbody"
).
length
,
// IE strips leading whitespace when .innerHTML is used
support
.
leadingWhitespace
=
div
.
firstChild
.
nodeType
===
3
;
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize
:
!!
div
.
getElementsByTagName
(
"link"
).
length
,
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
support
.
tbody
=
!
div
.
getElementsByTagName
(
"tbody"
).
length
;
// Get the style information from getAttribute
// (IE uses .cssText instead)
style
:
/top/
.
test
(
a
.
getAttribute
(
"style"
)
),
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
support
.
htmlSerialize
=
!!
div
.
getElementsByTagName
(
"link"
).
length
;
// Make sure that URLs aren't manipulated
// (IE normalizes it by default
)
hrefNormalized
:
a
.
getAttribute
(
"href"
)
===
"/a"
,
// Get the style information from getAttribute
// (IE uses .cssText instead
)
support
.
style
=
/top/
.
test
(
a
.
getAttribute
(
"style"
)
);
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity
:
/^0.5/
.
test
(
a
.
style
.
opacity
),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support
.
hrefNormalized
=
a
.
getAttribute
(
"href"
)
===
"/a"
;
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat
:
!!
a
.
style
.
cssFloat
,
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
support
.
opacity
=
/^0.5/
.
test
(
a
.
style
.
opacity
);
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
checkOn
:
!!
input
.
value
,
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support
.
cssFloat
=
!!
a
.
style
.
cssFloat
;
// 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)
optSelected
:
opt
.
selected
,
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support
.
checkOn
=
!!
input
.
value
;
// Tests for enctype support on a form (#6743)
enctype
:
!!
document
.
createElement
(
"form"
).
enctype
,
// 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)
support
.
optSelected
=
opt
.
selected
;
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone
:
document
.
createElement
(
"nav"
).
cloneNode
(
true
).
outerHTML
!==
"<:nav></:nav>"
,
// Tests for enctype support on a form (#6743)
support
.
enctype
=
!!
document
.
createElement
(
"form"
).
enctype
;
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel
:
document
.
compatMode
===
"CSS1Compat"
,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
support
.
html5Clone
=
document
.
createElement
(
"nav"
).
cloneNode
(
true
).
outerHTML
!==
"<:nav></:nav>"
;
// Will be defined later
deleteExpando
:
true
,
noCloneEvent
:
true
,
inlineBlockNeedsLayout
:
false
,
shrinkWrapBlocks
:
false
,
reliableMarginRight
:
true
,
boxSizingReliable
:
true
,
pixelPosition
:
false
};
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
support
.
boxModel
=
document
.
compatMode
===
"CSS1Compat"
;
// Will be defined later
support
.
inlineBlockNeedsLayout
=
false
;
support
.
shrinkWrapBlocks
=
false
;
support
.
pixelPosition
=
false
;
support
.
deleteExpando
=
true
;
support
.
noCloneEvent
=
true
;
support
.
reliableMarginRight
=
true
;
support
.
boxSizingReliable
=
true
;
// Make sure checked status is properly cloned
input
.
checked
=
true
;
...
...
@@ -237,5 +234,5 @@ jQuery.support = (function() {
all
=
select
=
fragment
=
opt
=
a
=
input
=
null
;
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