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
3892df20
Commit
3892df20
authored
Mar 25, 2011
by
timmywil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for bug #3116
parent
47c80c20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
attributes.js
src/attributes.js
+1
-1
attributes.js
test/unit/attributes.js
+12
-4
No files found.
src/attributes.js
View file @
3892df20
...
...
@@ -330,7 +330,7 @@ jQuery.extend({
// Check form objects in IE (multiple bugs related)
if
(
isFormObjects
)
{
// Return
s
undefined for empty string, which is the blank nodeValue in IE
// Return undefined for empty string, which is the blank nodeValue in IE
ret
=
elem
.
getAttributeNode
(
name
).
nodeValue
||
undefined
;
}
else
{
ret
=
elem
.
getAttribute
(
name
);
...
...
test/unit/attributes.js
View file @
3892df20
...
...
@@ -160,7 +160,7 @@ test("attr(Hash)", function() {
});
test
(
"attr(String, Object)"
,
function
()
{
expect
(
2
8
);
expect
(
2
9
);
var
div
=
jQuery
(
"div"
).
attr
(
"foo"
,
"bar"
),
fail
=
false
;
...
...
@@ -220,9 +220,9 @@ test("attr(String, Object)", function() {
jQuery
(
"#name"
).
attr
(
'someAttr'
,
'0'
);
equals
(
jQuery
(
"#name"
).
attr
(
'someAttr'
),
'0'
,
'Set attribute to a string of "0"'
);
jQuery
(
"#name"
).
attr
(
'someAttr'
,
0
);
equals
(
jQuery
(
"#name"
).
attr
(
'someAttr'
),
0
,
'Set attribute to the number 0'
);
equals
(
jQuery
(
"#name"
).
attr
(
'someAttr'
),
'0'
,
'Set attribute to the number 0'
);
jQuery
(
"#name"
).
attr
(
'someAttr'
,
1
);
equals
(
jQuery
(
"#name"
).
attr
(
'someAttr'
),
1
,
'Set attribute to the number 1'
);
equals
(
jQuery
(
"#name"
).
attr
(
'someAttr'
),
'1'
,
'Set attribute to the number 1'
);
// using contents will get comments regular, text, and comment nodes
var
j
=
jQuery
(
"#nonnodes"
).
contents
();
...
...
@@ -232,7 +232,8 @@ test("attr(String, Object)", function() {
j
.
removeAttr
(
"name"
);
QUnit
.
reset
();
// Type
var
type
=
jQuery
(
"#check2"
).
attr
(
'type'
);
var
thrown
=
false
;
try
{
...
...
@@ -272,6 +273,13 @@ test("attr(String, Object)", function() {
}
ok
(
thrown
,
"Exception thrown when trying to change type property"
);
equals
(
"button"
,
button
.
attr
(
'type'
),
"Verify that you can't change the type of a button element"
);
// Setting attributes on svg elements (bug #3116)
var
$svg
=
jQuery
(
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="3000" height="3000">'
+
'<circle cx="200" cy="200" r="150" />'
+
'</svg>'
).
appendTo
(
'body'
);
equals
(
$svg
.
attr
(
'cx'
,
100
).
attr
(
'cx'
),
"100"
,
"Set attribute on svg element"
);
$svg
.
remove
();
});
test
(
"attr(jquery_method)"
,
function
(){
...
...
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