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
76a84fba
Commit
76a84fba
authored
Sep 15, 2011
by
timmywil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call .is(:visible) on the window or document does not thrown an error in IE. Fixes #10267.
parent
daeb6650
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
css.js
src/css.js
+1
-1
css.js
test/unit/css.js
+8
-5
No files found.
src/css.js
View file @
76a84fba
...
@@ -371,7 +371,7 @@ if ( jQuery.expr && jQuery.expr.filters ) {
...
@@ -371,7 +371,7 @@ if ( jQuery.expr && jQuery.expr.filters ) {
var
width
=
elem
.
offsetWidth
,
var
width
=
elem
.
offsetWidth
,
height
=
elem
.
offsetHeight
;
height
=
elem
.
offsetHeight
;
return
(
width
===
0
&&
height
===
0
)
||
(
!
jQuery
.
support
.
reliableHiddenOffsets
&&
(
elem
.
style
.
display
||
jQuery
.
css
(
elem
,
"display"
))
===
"none"
);
return
(
width
===
0
&&
height
===
0
)
||
(
!
jQuery
.
support
.
reliableHiddenOffsets
&&
(
(
elem
.
style
&&
elem
.
style
.
display
)
||
jQuery
.
css
(
elem
,
"display"
))
===
"none"
);
};
};
jQuery
.
expr
.
filters
.
visible
=
function
(
elem
)
{
jQuery
.
expr
.
filters
.
visible
=
function
(
elem
)
{
...
...
test/unit/css.js
View file @
76a84fba
module
(
"css"
,
{
teardown
:
moduleTeardown
});
module
(
"css"
,
{
teardown
:
moduleTeardown
});
test
(
"css(String|Hash)"
,
function
()
{
test
(
"css(String|Hash)"
,
function
()
{
expect
(
4
2
);
expect
(
4
4
);
equals
(
jQuery
(
"#qunit-fixture"
).
css
(
"display"
),
"block"
,
"Check for css property
\"
display
\"
"
);
equals
(
jQuery
(
"#qunit-fixture"
).
css
(
"display"
),
"block"
,
"Check for css property
\"
display
\"
"
);
...
@@ -10,6 +10,8 @@ test("css(String|Hash)", function() {
...
@@ -10,6 +10,8 @@ test("css(String|Hash)", function() {
ok
(
!
jQuery
(
"#nothiddendiv"
).
is
(
":visible"
),
"Modified CSS display: Assert element is hidden"
);
ok
(
!
jQuery
(
"#nothiddendiv"
).
is
(
":visible"
),
"Modified CSS display: Assert element is hidden"
);
jQuery
(
"#nothiddendiv"
).
css
({
display
:
"block"
});
jQuery
(
"#nothiddendiv"
).
css
({
display
:
"block"
});
ok
(
jQuery
(
"#nothiddendiv"
).
is
(
":visible"
),
"Modified CSS display: Assert element is visible"
);
ok
(
jQuery
(
"#nothiddendiv"
).
is
(
":visible"
),
"Modified CSS display: Assert element is visible"
);
ok
(
jQuery
(
window
).
is
(
":visible"
),
"Calling is(':visible') on window does not throw an error in IE."
);
ok
(
jQuery
(
document
).
is
(
":visible"
),
"Calling is(':visible') on document does not throw an error in IE."
);
var
div
=
jQuery
(
"<div>"
);
var
div
=
jQuery
(
"<div>"
);
...
@@ -36,8 +38,8 @@ test("css(String|Hash)", function() {
...
@@ -36,8 +38,8 @@ test("css(String|Hash)", function() {
var
width
=
parseFloat
(
jQuery
(
"#nothiddendiv"
).
css
(
"width"
)),
height
=
parseFloat
(
jQuery
(
"#nothiddendiv"
).
css
(
"height"
));
var
width
=
parseFloat
(
jQuery
(
"#nothiddendiv"
).
css
(
"width"
)),
height
=
parseFloat
(
jQuery
(
"#nothiddendiv"
).
css
(
"height"
));
jQuery
(
"#nothiddendiv"
).
css
({
width
:
-
1
,
height
:
-
1
});
jQuery
(
"#nothiddendiv"
).
css
({
width
:
-
1
,
height
:
-
1
});
equals
(
parseFloat
(
jQuery
(
"#nothiddendiv"
).
css
(
"width"
)),
width
,
"Test negative width ignored"
)
equals
(
parseFloat
(
jQuery
(
"#nothiddendiv"
).
css
(
"width"
)),
width
,
"Test negative width ignored"
)
;
equals
(
parseFloat
(
jQuery
(
"#nothiddendiv"
).
css
(
"height"
)),
height
,
"Test negative height ignored"
)
equals
(
parseFloat
(
jQuery
(
"#nothiddendiv"
).
css
(
"height"
)),
height
,
"Test negative height ignored"
)
;
equals
(
jQuery
(
"<div style='display: none;'>"
).
css
(
"display"
),
"none"
,
"Styles on disconnected nodes"
);
equals
(
jQuery
(
"<div style='display: none;'>"
).
css
(
"display"
),
"none"
,
"Styles on disconnected nodes"
);
...
@@ -62,7 +64,8 @@ test("css(String|Hash)", function() {
...
@@ -62,7 +64,8 @@ test("css(String|Hash)", function() {
ok
(
true
,
"Requires the same number of tests"
):
ok
(
true
,
"Requires the same number of tests"
):
ok
(
~
jQuery
(
"#empty"
)[
0
].
currentStyle
.
filter
.
indexOf
(
"gradient"
),
"Assert setting opacity doesn't overwrite other filters of the stylesheet in IE"
);
ok
(
~
jQuery
(
"#empty"
)[
0
].
currentStyle
.
filter
.
indexOf
(
"gradient"
),
"Assert setting opacity doesn't overwrite other filters of the stylesheet in IE"
);
var
div
=
jQuery
(
"#nothiddendiv"
),
child
=
jQuery
(
"#nothiddendivchild"
);
div
=
jQuery
(
"#nothiddendiv"
);
var
child
=
jQuery
(
"#nothiddendivchild"
);
equals
(
parseInt
(
div
.
css
(
"fontSize"
)),
16
,
"Verify fontSize px set."
);
equals
(
parseInt
(
div
.
css
(
"fontSize"
)),
16
,
"Verify fontSize px set."
);
equals
(
parseInt
(
div
.
css
(
"font-size"
)),
16
,
"Verify fontSize px set."
);
equals
(
parseInt
(
div
.
css
(
"font-size"
)),
16
,
"Verify fontSize px set."
);
...
@@ -227,7 +230,7 @@ test("css(String, Object)", function() {
...
@@ -227,7 +230,7 @@ test("css(String, Object)", function() {
j
.
css
(
"overflow"
,
"visible"
);
j
.
css
(
"overflow"
,
"visible"
);
equals
(
j
.
css
(
"overflow"
),
"visible"
,
"Check node,textnode,comment css works"
);
equals
(
j
.
css
(
"overflow"
),
"visible"
,
"Check node,textnode,comment css works"
);
// opera sometimes doesn't update 'display' correctly, see #2037
// opera sometimes doesn't update 'display' correctly, see #2037
jQuery
(
"#t2037"
)[
0
].
innerHTML
=
jQuery
(
"#t2037"
)[
0
].
innerHTML
jQuery
(
"#t2037"
)[
0
].
innerHTML
=
jQuery
(
"#t2037"
)[
0
].
innerHTML
;
equals
(
jQuery
(
"#t2037 .hidden"
).
css
(
"display"
),
"none"
,
"Make sure browser thinks it is hidden"
);
equals
(
jQuery
(
"#t2037 .hidden"
).
css
(
"display"
),
"none"
,
"Make sure browser thinks it is hidden"
);
var
div
=
jQuery
(
"#nothiddendiv"
),
var
div
=
jQuery
(
"#nothiddendiv"
),
...
...
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