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
24142f60
Commit
24142f60
authored
Oct 19, 2006
by
Brandon Aaron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readonly: "readOnly" added to 'fix' in jQuery.attr plus tests
Cleaned up jQuery.clean method (Thanks Dave Methvin)
parent
ca91d789
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
37 deletions
+31
-37
jquery.js
src/jquery/jquery.js
+31
-37
No files found.
src/jquery/jquery.js
View file @
24142f60
...
@@ -449,6 +449,10 @@ jQuery.fn = jQuery.prototype = {
...
@@ -449,6 +449,10 @@ jQuery.fn = jQuery.prototype = {
* ok( document.getElementById('check2').checked == true, 'Set checked attribute' );
* ok( document.getElementById('check2').checked == true, 'Set checked attribute' );
* $("#check2").attr('checked', false);
* $("#check2").attr('checked', false);
* ok( document.getElementById('check2').checked == false, 'Set checked attribute' );
* ok( document.getElementById('check2').checked == false, 'Set checked attribute' );
* $("#text1").attr('readonly', true);
* ok( document.getElementById('text1').readOnly == true, 'Set readonly attribute' );
* $("#text1").attr('readonly', false);
* ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' );
*
*
* @test stop();
* @test stop();
* $.get('data/dashboard.xml', function(xml) {
* $.get('data/dashboard.xml', function(xml) {
...
@@ -1544,43 +1548,32 @@ jQuery.extend({
...
@@ -1544,43 +1548,32 @@ jQuery.extend({
clean
:
function
(
a
)
{
clean
:
function
(
a
)
{
var
r
=
[];
var
r
=
[];
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
{
if
(
a
[
i
].
constructor
==
String
)
{
if
(
a
[
i
].
constructor
==
String
)
{
// Convert html string into DOM nodes
// trim whitespace, otherwise indexOf won't work as expected
// Trim whitespace, otherwise indexOf won't work as expected
a
[
i
]
=
jQuery
.
trim
(
a
[
i
]);
var
s
=
jQuery
.
trim
(
a
[
i
]),
div
=
document
.
createElement
(
"div"
),
wrap
=
[
0
,
""
,
""
];
var
table
=
""
;
if
(
!
s
.
indexOf
(
"<opt"
)
)
// option or optgroup
wrap
=
[
1
,
"<select>"
,
"</select>"
];
if
(
!
a
[
i
].
indexOf
(
"<opt"
)
)
{
else
if
(
!
s
.
indexOf
(
"<thead"
)
||
!
s
.
indexOf
(
"<tbody"
)
)
table
=
"thead"
;
wrap
=
[
1
,
"<table>"
,
"</table>"
];
a
[
i
]
=
"<select>"
+
a
[
i
]
+
"</select>"
;
else
if
(
!
s
.
indexOf
(
"<tr"
)
)
}
else
if
(
!
a
[
i
].
indexOf
(
"<thead"
)
||
!
a
[
i
].
indexOf
(
"<tbody"
)
)
{
wrap
=
[
2
,
"<table>"
,
"</table>"
];
// tbody auto-inserted
table
=
"thead"
;
else
if
(
!
s
.
indexOf
(
"<td"
)
||
!
s
.
indexOf
(
"<th"
)
)
a
[
i
]
=
"<table>"
+
a
[
i
]
+
"</table>"
;
wrap
=
[
3
,
"<table><tbody><tr>"
,
"</tr></tbody></table>"
];
}
else
if
(
!
a
[
i
].
indexOf
(
"<tr"
)
)
{
table
=
"tr"
;
// Go to html and back, then peel off extra wrappers
a
[
i
]
=
"<table>"
+
a
[
i
]
+
"</table>"
;
div
.
innerHTML
=
wrap
[
1
]
+
s
+
wrap
[
2
];
}
else
if
(
!
a
[
i
].
indexOf
(
"<td"
)
||
!
a
[
i
].
indexOf
(
"<th"
)
)
{
while
(
wrap
[
0
]
--
)
div
=
div
.
firstChild
;
table
=
"td"
;
a
[
i
]
=
div
.
childNodes
;
a
[
i
]
=
"<table><tbody><tr>"
+
a
[
i
]
+
"</tr></tbody></table>"
;
}
}
var
div
=
document
.
createElement
(
"div"
);
if
(
a
[
i
].
length
!=
undefined
&&
!
a
[
i
].
nodeType
)
// Handles Array, jQuery, DOM NodeList collections
div
.
innerHTML
=
a
[
i
];
for
(
var
n
=
0
;
n
<
a
[
i
].
length
;
n
++
)
r
.
push
(
a
[
i
][
n
]);
if
(
table
)
{
div
=
div
.
firstChild
;
if
(
table
!=
"thead"
)
div
=
div
.
firstChild
;
if
(
table
==
"td"
)
div
=
div
.
firstChild
;
}
for
(
var
j
=
0
;
j
<
div
.
childNodes
.
length
;
j
++
)
r
.
push
(
div
.
childNodes
[
j
]
);
}
else
if
(
a
[
i
].
jquery
||
a
[
i
].
length
&&
!
a
[
i
].
nodeType
)
for
(
var
k
=
0
;
k
<
a
[
i
].
length
;
k
++
)
r
.
push
(
a
[
i
][
k
]
);
else
if
(
a
[
i
]
!==
null
)
else
if
(
a
[
i
]
!==
null
)
r
.
push
(
a
[
i
].
nodeType
?
a
[
i
]
:
document
.
createTextNode
(
a
[
i
].
toString
())
);
r
.
push
(
a
[
i
].
nodeType
?
a
[
i
]
:
document
.
createTextNode
(
a
[
i
].
toString
())
);
}
}
return
r
;
return
r
;
},
},
...
@@ -1884,7 +1877,8 @@ jQuery.extend({
...
@@ -1884,7 +1877,8 @@ jQuery.extend({
className
:
"className"
,
className
:
"className"
,
value
:
"value"
,
value
:
"value"
,
disabled
:
"disabled"
,
disabled
:
"disabled"
,
checked
:
"checked"
checked
:
"checked"
,
readonly
:
"readOnly"
};
};
// IE actually uses filters for opacity ... elem is actually elem.style
// IE actually uses filters for opacity ... elem is actually elem.style
...
...
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