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
0c971785
Commit
0c971785
authored
Jan 12, 2009
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed an issue with parentNode being accessed in attr() on disconnected DOM elements.
parent
af1b9994
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
core.js
src/core.js
+1
-1
core.js
test/unit/core.js
+3
-1
No files found.
src/core.js
View file @
0c971785
...
...
@@ -961,7 +961,7 @@ jQuery.extend({
// Safari mis-reports the default selected property of a hidden option
// Accessing the parent's selectedIndex property fixes it
if
(
name
==
"selected"
)
if
(
name
==
"selected"
&&
elem
.
parentNode
)
elem
.
parentNode
.
selectedIndex
;
// If applicable, access the attribute via the DOM 0 way
...
...
test/unit/core.js
View file @
0c971785
...
...
@@ -383,7 +383,7 @@ test("index(Object)", function() {
});
test
(
"attr(String)"
,
function
()
{
expect
(
2
6
);
expect
(
2
7
);
equals
(
jQuery
(
'#text1'
).
attr
(
'value'
),
"Test"
,
'Check for value attribute'
);
equals
(
jQuery
(
'#text1'
).
attr
(
'value'
,
"Test2"
).
attr
(
'defaultValue'
),
"Test"
,
'Check for defaultValue attribute'
);
equals
(
jQuery
(
'#text1'
).
attr
(
'type'
),
"text"
,
'Check for type attribute'
);
...
...
@@ -407,6 +407,8 @@ test("attr(String)", function() {
jQuery
(
'<a id="tAnchor5"></a>'
).
attr
(
'href'
,
'#5'
).
appendTo
(
'#main'
);
// using innerHTML in IE causes href attribute to be serialized to the full path
equals
(
jQuery
(
'#tAnchor5'
).
attr
(
'href'
),
"#5"
,
'Check for non-absolute href (an anchor)'
);
equals
(
jQuery
(
"<option/>"
).
attr
(
"selected"
),
false
,
"Check selected attribute on disconnected element."
);
// Related to [5574] and [5683]
var
body
=
document
.
body
,
$body
=
jQuery
(
body
);
...
...
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