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
954966e0
Commit
954966e0
authored
Feb 14, 2014
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support: Reduce size
Ref
a7ea12a9
parent
a7ea12a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
support.js
src/css/support.js
+19
-15
No files found.
src/css/support.js
View file @
954966e0
...
@@ -5,9 +5,6 @@ define([
...
@@ -5,9 +5,6 @@ define([
(
function
()
{
(
function
()
{
var
pixelPositionVal
,
boxSizingReliableVal
,
var
pixelPositionVal
,
boxSizingReliableVal
,
// Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions).
divReset
=
"padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;"
+
"-moz-box-sizing:content-box;box-sizing:content-box"
,
docElem
=
document
.
documentElement
,
docElem
=
document
.
documentElement
,
container
=
document
.
createElement
(
"div"
),
container
=
document
.
createElement
(
"div"
),
div
=
document
.
createElement
(
"div"
);
div
=
document
.
createElement
(
"div"
);
...
@@ -20,17 +17,20 @@ define([
...
@@ -20,17 +17,20 @@ define([
div
.
cloneNode
(
true
).
style
.
backgroundClip
=
""
;
div
.
cloneNode
(
true
).
style
.
backgroundClip
=
""
;
support
.
clearCloneStyle
=
div
.
style
.
backgroundClip
===
"content-box"
;
support
.
clearCloneStyle
=
div
.
style
.
backgroundClip
===
"content-box"
;
container
.
style
.
cssText
=
"border:0;width:0;height:0;
position:absolute;top:0;left:-9999
px;"
+
container
.
style
.
cssText
=
"border:0;width:0;height:0;
top:0;left:-9999px;margin-top:1
px;"
+
"
margin-top:1px
"
;
"
position:absolute
"
;
container
.
appendChild
(
div
);
container
.
appendChild
(
div
);
// Executing both pixelPosition & boxSizingReliable tests require only one layout
// Executing both pixelPosition & boxSizingReliable tests require only one layout
// so they're executed at the same time to save the second computation.
// so they're executed at the same time to save the second computation.
function
computePixelPositionAndBoxSizingReliable
()
{
function
computePixelPositionAndBoxSizingReliable
()
{
// Support: Firefox<29, Android 2.3 (Prefixed box-sizing versions).
div
.
style
.
cssText
=
div
.
style
.
cssText
=
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;"
+
// Support: Firefox<29, Android 2.3
"box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;"
+
// Vendor-prefix box-sizing
"position:absolute;top:1%"
;
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;"
+
"box-sizing:border-box;display:block;margin-top:1%;top:1%;"
+
"border:1px;padding:1px;width:4px;position:absolute"
;
div
.
innerHTML
=
""
;
docElem
.
appendChild
(
container
);
docElem
.
appendChild
(
container
);
var
divStyle
=
window
.
getComputedStyle
(
div
,
null
);
var
divStyle
=
window
.
getComputedStyle
(
div
,
null
);
...
@@ -40,9 +40,10 @@ define([
...
@@ -40,9 +40,10 @@ define([
docElem
.
removeChild
(
container
);
docElem
.
removeChild
(
container
);
}
}
// Use window.getComputedStyle because jsdom on node.js will break without it.
// Support: node.js jsdom
// Don't assume that getComputedStyle is a property of the global object
if
(
window
.
getComputedStyle
)
{
if
(
window
.
getComputedStyle
)
{
jQuery
.
extend
(
support
,
{
jQuery
.
extend
(
support
,
{
pixelPosition
:
function
()
{
pixelPosition
:
function
()
{
// This test is executed only once but we still do memoizing
// This test is executed only once but we still do memoizing
// since we can use the boxSizingReliable pre-computing.
// since we can use the boxSizingReliable pre-computing.
...
@@ -64,7 +65,13 @@ define([
...
@@ -64,7 +65,13 @@ define([
// This support function is only executed once so no memoizing is needed.
// This support function is only executed once so no memoizing is needed.
var
ret
,
var
ret
,
marginDiv
=
div
.
appendChild
(
document
.
createElement
(
"div"
)
);
marginDiv
=
div
.
appendChild
(
document
.
createElement
(
"div"
)
);
marginDiv
.
style
.
cssText
=
div
.
style
.
cssText
=
divReset
;
// Reset CSS: box-sizing; display; margin; border; padding
marginDiv
.
style
.
cssText
=
div
.
style
.
cssText
=
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;"
+
"box-sizing:content-box;display:block;margin:0;border:0;padding:0"
;
marginDiv
.
style
.
marginRight
=
marginDiv
.
style
.
width
=
"0"
;
marginDiv
.
style
.
marginRight
=
marginDiv
.
style
.
width
=
"0"
;
div
.
style
.
width
=
"1px"
;
div
.
style
.
width
=
"1px"
;
docElem
.
appendChild
(
container
);
docElem
.
appendChild
(
container
);
...
@@ -73,9 +80,6 @@ define([
...
@@ -73,9 +80,6 @@ define([
docElem
.
removeChild
(
container
);
docElem
.
removeChild
(
container
);
// Clean up the div for other support tests.
div
.
innerHTML
=
""
;
return
ret
;
return
ret
;
}
}
});
});
...
...
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