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
bc82ff0f
Commit
bc82ff0f
authored
May 13, 2011
by
timmywil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure setting boolean attributes to the same name sets the property to a boolean type
parent
6f676e69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
attributes.js
src/attributes.js
+1
-1
attributes.js
test/unit/attributes.js
+6
-1
No files found.
src/attributes.js
View file @
bc82ff0f
...
@@ -481,7 +481,7 @@ boolHook = {
...
@@ -481,7 +481,7 @@ boolHook = {
propName
=
jQuery
.
propFix
[
name
]
||
name
;
propName
=
jQuery
.
propFix
[
name
]
||
name
;
if
(
propName
in
elem
)
{
if
(
propName
in
elem
)
{
// Only set the IDL specifically if it already exists on the element
// Only set the IDL specifically if it already exists on the element
elem
[
propName
]
=
val
ue
;
elem
[
propName
]
=
tr
ue
;
}
}
elem
.
setAttribute
(
name
,
name
.
toLowerCase
()
);
elem
.
setAttribute
(
name
,
name
.
toLowerCase
()
);
...
...
test/unit/attributes.js
View file @
bc82ff0f
...
@@ -150,7 +150,7 @@ test("attr(Hash)", function() {
...
@@ -150,7 +150,7 @@ test("attr(Hash)", function() {
});
});
test
(
"attr(String, Object)"
,
function
()
{
test
(
"attr(String, Object)"
,
function
()
{
expect
(
6
6
);
expect
(
6
9
);
var
div
=
jQuery
(
"div"
).
attr
(
"foo"
,
"bar"
),
var
div
=
jQuery
(
"div"
).
attr
(
"foo"
,
"bar"
),
fail
=
false
;
fail
=
false
;
...
@@ -199,6 +199,11 @@ test("attr(String, Object)", function() {
...
@@ -199,6 +199,11 @@ test("attr(String, Object)", function() {
equals
(
jQuery
(
"#check2"
).
prop
(
"checked"
),
false
,
"Set checked attribute"
);
equals
(
jQuery
(
"#check2"
).
prop
(
"checked"
),
false
,
"Set checked attribute"
);
equals
(
jQuery
(
"#check2"
).
attr
(
"checked"
),
undefined
,
"Set checked attribute"
);
equals
(
jQuery
(
"#check2"
).
attr
(
"checked"
),
undefined
,
"Set checked attribute"
);
jQuery
(
"#check2"
).
attr
(
"checked"
,
"checked"
);
equal
(
document
.
getElementById
(
"check2"
).
checked
,
true
,
"Set checked attribute with 'checked'"
);
equal
(
jQuery
(
"#check2"
).
prop
(
"checked"
),
true
,
"Set checked attribute"
);
equal
(
jQuery
(
"#check2"
).
attr
(
"checked"
),
"checked"
,
"Set checked attribute"
);
jQuery
(
"#text1"
).
prop
(
"readOnly"
,
true
);
jQuery
(
"#text1"
).
prop
(
"readOnly"
,
true
);
equals
(
document
.
getElementById
(
"text1"
).
readOnly
,
true
,
"Set readonly attribute"
);
equals
(
document
.
getElementById
(
"text1"
).
readOnly
,
true
,
"Set readonly attribute"
);
equals
(
jQuery
(
"#text1"
).
prop
(
"readOnly"
),
true
,
"Set readonly attribute"
);
equals
(
jQuery
(
"#text1"
).
prop
(
"readOnly"
),
true
,
"Set readonly attribute"
);
...
...
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