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
1dda994c
Commit
1dda994c
authored
Apr 14, 2011
by
jeresig
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '8099' of
https://github.com/rwldrn/jquery
. Fixes #8099.
Conflicts: test/data/testsuite.css
parents
84712bd6
a76decc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
4 deletions
+65
-4
effects.js
src/effects.js
+37
-3
testsuite.css
test/data/testsuite.css
+6
-1
effects.js
test/unit/effects.js
+22
-0
No files found.
src/effects.js
View file @
1dda994c
(
function
(
jQuery
)
{
(
function
(
jQuery
)
{
var
elemdisplay
=
{},
var
elemdisplay
=
{},
iframe
=
null
,
iframeDoc
=
null
,
rfxtypes
=
/^
(?:
toggle|show|hide
)
$/
,
rfxtypes
=
/^
(?:
toggle|show|hide
)
$/
,
rfxnum
=
/^
([
+
\-]
=
)?([\d
+.
\-]
+
)([
a-z%
]
*
)
$/i
,
rfxnum
=
/^
([
+
\-]
=
)?([\d
+.
\-]
+
)([
a-z%
]
*
)
$/i
,
timerId
,
timerId
,
...
@@ -548,20 +550,52 @@ if ( jQuery.expr && jQuery.expr.filters ) {
...
@@ -548,20 +550,52 @@ if ( jQuery.expr && jQuery.expr.filters ) {
}
}
function
defaultDisplay
(
nodeName
)
{
function
defaultDisplay
(
nodeName
)
{
if
(
!
elemdisplay
[
nodeName
]
)
{
if
(
!
elemdisplay
[
nodeName
]
)
{
var
elem
=
jQuery
(
"<"
+
nodeName
+
">"
).
appendTo
(
"body"
),
display
=
elem
.
css
(
"display"
);
var
elem
=
jQuery
(
"<"
+
nodeName
+
">"
).
appendTo
(
"body"
),
display
=
elem
.
css
(
"display"
);
elem
.
remove
();
elem
.
remove
();
if
(
display
===
"none"
||
display
===
""
)
{
if
(
display
===
"none"
||
display
===
""
)
{
display
=
"block"
;
// Get element's real default display by attaching it to a temp iframe
// Conritbutions from Louis Remi and Julian Aurbourg
// based on recommendation by Louis Remi
// No iframe to use yet, so create it
if
(
!
iframe
)
{
iframe
=
document
.
createElement
(
"iframe"
);
iframe
.
frameBorder
=
iframe
.
width
=
iframe
.
height
=
0
;
}
document
.
body
.
appendChild
(
iframe
);
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake html
// document to it, Webkit & Firefox won't allow reusing the iframe document
if
(
!
iframeDoc
||
!
iframe
.
createElement
)
{
iframeDoc
=
(
iframe
.
contentWindow
||
iframe
.
contentDocument
).
document
;
iframeDoc
.
write
(
"<!doctype><html><body></body></html>"
);
}
elem
=
iframeDoc
.
createElement
(
nodeName
);
iframeDoc
.
body
.
appendChild
(
elem
);
display
=
jQuery
.
css
(
elem
,
"display"
);
document
.
body
.
removeChild
(
iframe
);
}
}
// Store the correct default display
elemdisplay
[
nodeName
]
=
display
;
elemdisplay
[
nodeName
]
=
display
;
}
}
return
elemdisplay
[
nodeName
];
return
elemdisplay
[
nodeName
];
}
}
})(
jQuery
);
})(
jQuery
);
test/data/testsuite.css
View file @
1dda994c
...
@@ -111,4 +111,9 @@ div#show-tests * { display: none; }
...
@@ -111,4 +111,9 @@ div#show-tests * { display: none; }
#nothiddendivchild
.prct
{
font-size
:
150%
;
}
#nothiddendivchild
.prct
{
font-size
:
150%
;
}
/* For testing type on vml in IE #7071 */
/* For testing type on vml in IE #7071 */
v
\
:oval
{
behavior
:
url(#default#VML)
;
display
:
inline-block
;
}
v
\
:oval
{
behavior
:
url(#default#VML)
;
display
:
inline-block
;
}
\ No newline at end of file
/* 8099 changes to default styles are read correctly */
tt
{
display
:
none
;
}
sup
{
display
:
none
;
}
dfn
{
display
:
none
;
}
test/unit/effects.js
View file @
1dda994c
...
@@ -162,6 +162,28 @@ test("Persist correct display value", function() {
...
@@ -162,6 +162,28 @@ test("Persist correct display value", function() {
});
});
});
});
test
(
"show() resolves correct default display #8099"
,
function
()
{
expect
(
7
);
var
tt8099
=
jQuery
(
"<tt/>"
).
appendTo
(
"body"
),
dfn8099
=
jQuery
(
"<dfn/>"
,
{
html
:
"foo"
}).
appendTo
(
"body"
);
equals
(
tt8099
.
css
(
"display"
),
"none"
,
"default display override for all tt"
);
equals
(
tt8099
.
show
().
css
(
"display"
),
"inline"
,
"Correctly resolves display:inline"
);
equals
(
jQuery
(
"#foo"
).
hide
().
show
().
css
(
"display"
),
"block"
,
"Correctly resolves display:block after hide/show"
);
equals
(
tt8099
.
hide
().
css
(
"display"
),
"none"
,
"default display override for all tt"
);
equals
(
tt8099
.
show
().
css
(
"display"
),
"inline"
,
"Correctly resolves display:inline"
);
equals
(
dfn8099
.
css
(
"display"
),
"none"
,
"default display override for all dfn"
);
equals
(
dfn8099
.
show
().
css
(
"display"
),
"inline"
,
"Correctly resolves display:inline"
);
tt8099
.
remove
();
dfn8099
.
remove
();
});
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