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
9559b1a2
Commit
9559b1a2
authored
Apr 23, 2011
by
aFarkas
Committed by
timmywil
Apr 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dealing with boolean content attribute
parent
02ad0aa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
15 deletions
+4
-15
attributes.js
src/attributes.js
+4
-15
No files found.
src/attributes.js
View file @
9559b1a2
...
...
@@ -311,7 +311,7 @@ jQuery.extend({
if
(
value
!==
undefined
)
{
if
(
value
===
null
)
{
if
(
value
===
null
||
value
===
false
)
{
jQuery
.
removeAttr
(
elem
,
name
);
return
undefined
;
...
...
@@ -319,6 +319,9 @@ jQuery.extend({
return
ret
;
}
else
{
if
(
value
===
true
){
value
=
name
;
}
elem
.
setAttribute
(
name
,
""
+
value
);
return
value
;
}
...
...
@@ -478,20 +481,6 @@ if ( !jQuery.support.getSetAttribute ) {
});
}
// Remove certain attrs if set to false
jQuery
.
each
([
"selected"
,
"checked"
,
"readOnly"
,
"disabled"
],
function
(
i
,
name
)
{
jQuery
.
attrHooks
[
name
]
=
jQuery
.
extend
(
jQuery
.
attrHooks
[
name
],
{
set
:
function
(
elem
,
value
)
{
if
(
value
===
true
)
{
elem
.
setAttribute
(
name
,
name
);
return
value
;
}
else
if
(
value
===
false
)
{
jQuery
.
removeAttr
(
elem
,
name
);
return
value
;
}
}
});
});
// Some attributes require a special call on IE
if
(
!
jQuery
.
support
.
hrefNormalized
)
{
...
...
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