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
22a4e5bd
Commit
22a4e5bd
authored
Feb 10, 2013
by
Oleg
Committed by
Dave Methvin
Feb 28, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Squeeze support module. Close gh-1165.
parent
eee2eaf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
32 deletions
+22
-32
support.js
src/support.js
+22
-32
No files found.
src/support.js
View file @
22a4e5bd
jQuery
.
support
=
(
function
(
support
)
{
var
a
,
select
,
opt
,
input
,
fragment
,
div
=
document
.
createElement
(
"div"
)
;
// Finish early in limited (non-browser) environments
div
.
innerHTML
=
"<a>a</a><input type='checkbox'/>"
;
a
=
div
.
getElementsByTagName
(
"a"
)[
0
];
if
(
!
a
)
{
var
input
=
document
.
createElement
(
"input"
),
fragment
=
document
.
createDocumentFragment
()
,
div
=
document
.
createElement
(
"div"
)
,
select
=
document
.
createElement
(
"select"
),
opt
=
select
.
appendChild
(
document
.
createElement
(
"option"
)
);
// Finish early in limited environments
if
(
!
input
.
type
)
{
return
support
;
}
// First batch of tests
select
=
document
.
createElement
(
"select"
);
opt
=
select
.
appendChild
(
document
.
createElement
(
"option"
)
);
input
=
div
.
getElementsByTagName
(
"input"
)[
0
];
input
.
type
=
"checkbox"
;
a
.
style
.
cssText
=
"float:left;opacity:.5"
;
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support
.
checkOn
=
!!
input
.
value
;
// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
support
.
checkOn
=
input
.
value
===
""
;
// Must access the parent to make an option select properly
// Support: IE9, IE10
...
...
@@ -33,6 +28,7 @@ jQuery.support = (function( support ) {
support
.
pixelPosition
=
false
;
// Make sure checked status is properly cloned
// Support: IE9, IE10
input
.
checked
=
true
;
support
.
noCloneChecked
=
input
.
cloneNode
(
true
).
checked
;
...
...
@@ -42,25 +38,24 @@ jQuery.support = (function( support ) {
support
.
optDisabled
=
!
opt
.
disabled
;
// Check if an input maintains its value after becoming a radio
// Support: IE9, IE10, Opera
input
=
document
.
createElement
(
"input"
);
input
.
value
=
"t"
;
input
.
setAttribute
(
"type"
,
"radio"
)
;
input
.
type
=
"radio"
;
support
.
radioValue
=
input
.
value
===
"t"
;
// #11217 - WebKit loses check when the name is after the checked attribute
input
.
setAttribute
(
"checked"
,
"t"
);
input
.
setAttribute
(
"name"
,
"t"
);
fragment
=
document
.
createDocumentFragment
();
fragment
.
appendChild
(
input
);
// WebKit doesn't clone checked state correctly in fragments
//
old
WebKit doesn't clone checked state correctly in fragments
support
.
checkClone
=
fragment
.
cloneNode
(
true
).
cloneNode
(
true
).
lastChild
.
checked
;
// Support: Firefox 17+
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
div
.
setAttribute
(
"onfocusin"
,
"t"
);
support
.
focusinBubbles
=
"onfocusin"
in
window
||
div
.
attributes
.
onfocusin
.
expando
===
false
;
support
.
focusinBubbles
=
"onfocusin"
in
window
;
div
.
style
.
backgroundClip
=
"content-box"
;
div
.
cloneNode
(
true
).
style
.
backgroundClip
=
""
;
...
...
@@ -68,9 +63,9 @@ jQuery.support = (function( support ) {
// Run tests that need a body at doc ready
jQuery
(
function
()
{
var
container
,
marginDiv
,
tds
,
var
container
,
marginDiv
,
divReset
=
"padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"
,
body
=
document
.
getElementsByTagName
(
"body"
)[
0
];
body
=
document
.
getElementsByTagName
(
"body"
)[
0
];
if
(
!
body
)
{
// Return for frameset docs that don't have a body
...
...
@@ -84,8 +79,9 @@ jQuery.support = (function( support ) {
body
.
appendChild
(
container
).
appendChild
(
div
);
div
.
innerHTML
=
""
;
div
.
style
.
cssText
=
"box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"
;
support
.
boxSizing
=
(
div
.
offsetWidth
===
4
);
support
.
doesNotIncludeMarginInBodyOffset
=
(
body
.
offsetTop
!==
1
);
support
.
boxSizing
=
div
.
offsetWidth
===
4
;
support
.
doesNotIncludeMarginInBodyOffset
=
body
.
offsetTop
!==
1
;
// Use window.getComputedStyle because jsdom on node.js will break without it.
if
(
window
.
getComputedStyle
)
{
...
...
@@ -106,14 +102,8 @@ jQuery.support = (function( support ) {
}
body
.
removeChild
(
container
);
// Null elements to avoid leaks in IE
container
=
div
=
tds
=
marginDiv
=
null
;
});
// Null elements to avoid leaks in IE
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