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
bb940851
Commit
bb940851
authored
Feb 14, 2011
by
jeresig
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '8099' of
https://github.com/rwldrn/jquery
into rwldrn-8099
parents
3ad8dd24
c67867ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
3 deletions
+43
-3
effects.js
src/effects.js
+28
-3
testsuite.css
test/data/testsuite.css
+3
-0
effects.js
test/unit/effects.js
+12
-0
No files found.
src/effects.js
View file @
bb940851
...
@@ -505,17 +505,42 @@ if ( jQuery.expr && jQuery.expr.filters ) {
...
@@ -505,17 +505,42 @@ if ( jQuery.expr && jQuery.expr.filters ) {
}
}
function
defaultDisplay
(
nodeName
)
{
function
defaultDisplay
(
nodeName
)
{
var
stylesheets
=
document
.
styleSheets
,
disabled
=
[],
elem
,
display
,
style
,
idx
;
if
(
!
elemdisplay
[
nodeName
]
)
{
if
(
!
elemdisplay
[
nodeName
]
)
{
var
elem
=
jQuery
(
"<"
+
nodeName
+
">"
).
appendTo
(
"body"
),
display
=
elem
.
css
(
"display"
);
// #8099 - If the end-dev has globally changed a default
// display, we can temporarily disable their styles to check
// for the correct default value
for
(
idx
=
0
;
idx
<
stylesheets
.
length
;
++
idx
)
{
style
=
stylesheets
[
idx
];
disabled
[
idx
]
=
style
.
disabled
;
style
.
disabled
=
true
;
}
// To accurately check an element's default display value,
// create a temp element and check it's default display, this
// will ensure that the value returned is not a user-tampered
// value.
elem
=
jQuery
(
"<"
+
nodeName
+
">"
).
appendTo
(
"body"
),
display
=
elem
.
css
(
"display"
);
// Remove temp element
elem
.
remove
();
elem
.
remove
();
if
(
display
===
"none"
||
display
===
""
)
{
if
(
display
===
"none"
||
display
===
""
)
{
display
=
"block"
;
display
=
"block"
;
}
}
// Store the correct default display
elemdisplay
[
nodeName
]
=
display
;
elemdisplay
[
nodeName
]
=
display
;
// Restore stylesheets
for
(
idx
=
0
;
idx
<
stylesheets
.
length
;
++
idx
)
{
stylesheets
[
idx
].
disabled
=
disabled
[
idx
];
}
}
}
return
elemdisplay
[
nodeName
];
return
elemdisplay
[
nodeName
];
...
...
test/data/testsuite.css
View file @
bb940851
...
@@ -109,3 +109,6 @@ div#show-tests * { display: none; }
...
@@ -109,3 +109,6 @@ div#show-tests * { display: none; }
#nothiddendiv
{
font-size
:
16px
;
}
#nothiddendiv
{
font-size
:
16px
;
}
#nothiddendivchild
.em
{
font-size
:
2em
;
}
#nothiddendivchild
.em
{
font-size
:
2em
;
}
#nothiddendivchild
.prct
{
font-size
:
150%
;
}
#nothiddendivchild
.prct
{
font-size
:
150%
;
}
/* 8099 changes to default styles are read correctly */
tt
{
display
:
none
;
}
test/unit/effects.js
View file @
bb940851
...
@@ -162,6 +162,18 @@ test("Persist correct display value", function() {
...
@@ -162,6 +162,18 @@ test("Persist correct display value", function() {
});
});
});
});
test
(
"show() resolves correct default display #8099"
,
function
()
{
expect
(
3
);
var
bug8099
=
jQuery
(
"<tt/>"
).
appendTo
(
"#main"
);
equals
(
bug8099
.
css
(
"display"
),
"none"
,
"default display override for all tt"
);
equals
(
bug8099
.
show
().
css
(
"display"
),
"inline"
,
"Correctly resolves display:inline"
);
bug8099
.
remove
();
equals
(
jQuery
(
"#foo"
).
hide
().
show
().
css
(
"display"
),
"block"
,
"Correctly resolves display:block after hide/show"
);
});
test
(
"animate(Hash, Object, Function)"
,
function
()
{
test
(
"animate(Hash, Object, Function)"
,
function
()
{
expect
(
1
);
expect
(
1
);
stop
();
stop
();
...
...
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