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
3728a8ac
Commit
3728a8ac
authored
Mar 21, 2007
by
Brandon Aaron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #1064 and added tests for setting/getting opacity
parent
36774226
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
coreTest.js
src/jquery/coreTest.js
+20
-2
jquery.js
src/jquery/jquery.js
+1
-1
No files found.
src/jquery/coreTest.js
View file @
3728a8ac
...
@@ -240,7 +240,7 @@ if ( location.protocol != "file:" ) {
...
@@ -240,7 +240,7 @@ if ( location.protocol != "file:" ) {
}
}
test
(
"css(String|Hash)"
,
function
()
{
test
(
"css(String|Hash)"
,
function
()
{
expect
(
8
);
expect
(
19
);
ok
(
$
(
'#main'
).
css
(
"display"
)
==
'none'
,
'Check for css property "display"'
);
ok
(
$
(
'#main'
).
css
(
"display"
)
==
'none'
,
'Check for css property "display"'
);
...
@@ -258,10 +258,19 @@ test("css(String|Hash)", function() {
...
@@ -258,10 +258,19 @@ test("css(String|Hash)", function() {
ok
(
$
(
'#floatTest'
).
css
(
'float'
)
==
'right'
,
'Modified CSS float using "float": Assert float is right'
);
ok
(
$
(
'#floatTest'
).
css
(
'float'
)
==
'right'
,
'Modified CSS float using "float": Assert float is right'
);
$
(
'#floatTest'
).
css
({
'font-size'
:
'30px'
});
$
(
'#floatTest'
).
css
({
'font-size'
:
'30px'
});
ok
(
$
(
'#floatTest'
).
css
(
'font-size'
)
==
'30px'
,
'Modified CSS font-size: Assert font-size is 30px'
);
ok
(
$
(
'#floatTest'
).
css
(
'font-size'
)
==
'30px'
,
'Modified CSS font-size: Assert font-size is 30px'
);
$
.
each
(
"0,0.25,0.5,0.75,1"
.
split
(
','
),
function
(
i
,
n
)
{
$
(
'#foo'
).
css
({
opacity
:
n
});
ok
(
$
(
'#foo'
).
css
(
'opacity'
)
==
n
,
"Assert opacity is "
+
n
+
" as a String"
);
$
(
'#foo'
).
css
({
opacity
:
parseFloat
(
n
)});
ok
(
$
(
'#foo'
).
css
(
'opacity'
)
==
n
,
"Assert opacity is "
+
n
+
" as a Number"
);
});
$
(
'#foo'
).
css
({
opacity
:
''
});
ok
(
$
(
'#foo'
).
css
(
'opacity'
)
==
'1'
,
"Assert opacity is 1 when set to an empty String"
);
});
});
test
(
"css(String, Object)"
,
function
()
{
test
(
"css(String, Object)"
,
function
()
{
expect
(
7
);
expect
(
18
);
ok
(
$
(
'#foo'
).
is
(
':visible'
),
'Modifying CSS display: Assert element is visible'
);
ok
(
$
(
'#foo'
).
is
(
':visible'
),
'Modifying CSS display: Assert element is visible'
);
$
(
'#foo'
).
css
(
'display'
,
'none'
);
$
(
'#foo'
).
css
(
'display'
,
'none'
);
ok
(
!
$
(
'#foo'
).
is
(
':visible'
),
'Modified CSS display: Assert element is hidden'
);
ok
(
!
$
(
'#foo'
).
is
(
':visible'
),
'Modified CSS display: Assert element is hidden'
);
...
@@ -276,6 +285,15 @@ test("css(String, Object)", function() {
...
@@ -276,6 +285,15 @@ test("css(String, Object)", function() {
ok
(
$
(
'#floatTest'
).
css
(
'float'
)
==
'left'
,
'Modified CSS float using "float": Assert float is left'
);
ok
(
$
(
'#floatTest'
).
css
(
'float'
)
==
'left'
,
'Modified CSS float using "float": Assert float is left'
);
$
(
'#floatTest'
).
css
(
'font-size'
,
'20px'
);
$
(
'#floatTest'
).
css
(
'font-size'
,
'20px'
);
ok
(
$
(
'#floatTest'
).
css
(
'font-size'
)
==
'20px'
,
'Modified CSS font-size: Assert font-size is 20px'
);
ok
(
$
(
'#floatTest'
).
css
(
'font-size'
)
==
'20px'
,
'Modified CSS font-size: Assert font-size is 20px'
);
$
.
each
(
"0,0.25,0.5,0.75,1"
.
split
(
','
),
function
(
i
,
n
)
{
$
(
'#foo'
).
css
(
'opacity'
,
n
);
ok
(
$
(
'#foo'
).
css
(
'opacity'
)
==
n
,
"Assert opacity is "
+
n
+
" as a String"
);
$
(
'#foo'
).
css
(
'opacity'
,
parseFloat
(
n
));
ok
(
$
(
'#foo'
).
css
(
'opacity'
)
==
n
,
"Assert opacity is "
+
n
+
" as a Number"
);
});
$
(
'#foo'
).
css
(
'opacity'
,
''
);
ok
(
$
(
'#foo'
).
css
(
'opacity'
)
==
'1'
,
"Assert opacity is 1 when set to an empty String"
);
});
});
test
(
"text()"
,
function
()
{
test
(
"text()"
,
function
()
{
...
...
src/jquery/jquery.js
View file @
3728a8ac
...
@@ -1537,7 +1537,7 @@ jQuery.extend({
...
@@ -1537,7 +1537,7 @@ jQuery.extend({
}
}
return
elem
.
filter
?
return
elem
.
filter
?
(
parseFloat
(
elem
.
filter
.
match
(
/opacity=
([^
)
]
*
)
/
)[
1
]
)
/
100
).
toString
()
:
""
;
(
parseFloat
(
elem
.
filter
.
match
(
/opacity=
([^
)
]
*
)
/
)[
1
]
)
/
100
).
toString
()
:
1
;
}
}
// Certain attributes only work when accessed via the old DOM 0 way
// Certain attributes only work when accessed via the old DOM 0 way
...
...
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