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
7d5b86ec
Commit
7d5b86ec
authored
Dec 10, 2012
by
Rick Waldron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor defaultDisplay's node creation and display logic, -6
parent
2eda329b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
css.js
src/css.js
+13
-10
No files found.
src/css.js
View file @
7d5b86ec
...
@@ -443,17 +443,13 @@ function getWidthOrHeight( elem, name, extra ) {
...
@@ -443,17 +443,13 @@ function getWidthOrHeight( elem, name, extra ) {
)
+
"px"
;
)
+
"px"
;
}
}
// Try to determine the default display value of an element
// Try to determine the default display value of an element
function
css_defaultDisplay
(
nodeName
)
{
function
css_defaultDisplay
(
nodeName
)
{
var
elem
,
var
doc
=
document
,
doc
=
document
,
display
=
elemdisplay
[
nodeName
];
display
=
elemdisplay
[
nodeName
];
if
(
!
display
)
{
if
(
!
display
)
{
elem
=
jQuery
(
doc
.
createElement
(
nodeName
)
);
display
=
actualDisplay
(
nodeName
,
doc
);
display
=
curCSS
(
elem
.
appendTo
(
doc
.
body
)[
0
],
"display"
);
elem
.
remove
();
// If the simple way fails, read from inside an iframe
// If the simple way fails, read from inside an iframe
if
(
display
===
"none"
||
!
display
)
{
if
(
display
===
"none"
||
!
display
)
{
...
@@ -468,9 +464,7 @@ function css_defaultDisplay( nodeName ) {
...
@@ -468,9 +464,7 @@ function css_defaultDisplay( nodeName ) {
doc
.
write
(
"<!doctype html><html><body>"
);
doc
.
write
(
"<!doctype html><html><body>"
);
doc
.
close
();
doc
.
close
();
elem
=
jQuery
(
doc
.
createElement
(
nodeName
)
);
display
=
actualDisplay
(
nodeName
,
doc
);
display
=
curCSS
(
elem
.
appendTo
(
doc
.
body
)[
0
],
"display"
);
elem
.
remove
();
iframe
.
detach
();
iframe
.
detach
();
}
}
...
@@ -481,6 +475,15 @@ function css_defaultDisplay( nodeName ) {
...
@@ -481,6 +475,15 @@ function css_defaultDisplay( nodeName ) {
return
display
;
return
display
;
}
}
// Called ONLY from within css_defaultDisplay
function
actualDisplay
(
name
,
doc
)
{
var
elem
,
display
;
elem
=
jQuery
(
doc
.
createElement
(
name
)
);
display
=
curCSS
(
elem
.
appendTo
(
doc
.
body
)[
0
],
"display"
);
elem
.
remove
();
return
display
;
}
jQuery
.
each
([
"height"
,
"width"
],
function
(
i
,
name
)
{
jQuery
.
each
([
"height"
,
"width"
],
function
(
i
,
name
)
{
jQuery
.
cssHooks
[
name
]
=
{
jQuery
.
cssHooks
[
name
]
=
{
get
:
function
(
elem
,
computed
,
extra
)
{
get
:
function
(
elem
,
computed
,
extra
)
{
...
@@ -541,7 +544,7 @@ if ( !jQuery.support.opacity ) {
...
@@ -541,7 +544,7 @@ if ( !jQuery.support.opacity ) {
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
// if value === "", then remove inline opacity #12685
// if value === "", then remove inline opacity #12685
if
(
(
value
>=
1
||
value
===
""
)
&&
if
(
(
value
>=
1
||
value
===
""
)
&&
jQuery
.
trim
(
filter
.
replace
(
ralpha
,
""
)
)
===
""
&&
jQuery
.
trim
(
filter
.
replace
(
ralpha
,
""
)
)
===
""
&&
style
.
removeAttribute
)
{
style
.
removeAttribute
)
{
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
...
...
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