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
641ad802
Commit
641ad802
authored
Jun 13, 2011
by
timmywil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attribute hooks do not need to be attached in XML docs. Fixes #9568.
parent
39a2f29c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
18 deletions
+22
-18
attributes.js
src/attributes.js
+17
-14
dashboard.xml
test/data/dashboard.xml
+1
-1
attributes.js
test/unit/attributes.js
+4
-3
No files found.
src/attributes.js
View file @
641ad802
...
...
@@ -320,21 +320,23 @@ jQuery.extend({
notxml
=
nType
!==
1
||
!
jQuery
.
isXMLDoc
(
elem
);
// Normalize the name if needed
name
=
notxml
&&
jQuery
.
attrFix
[
name
]
||
name
;
if
(
notxml
)
{
name
=
jQuery
.
attrFix
[
name
]
||
name
;
hooks
=
jQuery
.
attrHooks
[
name
];
hooks
=
jQuery
.
attrHooks
[
name
];
if
(
!
hooks
)
{
// Use boolHook for boolean attributes
if
(
rboolean
.
test
(
name
)
)
{
if
(
!
hooks
)
{
// Use boolHook for boolean attributes
if
(
rboolean
.
test
(
name
)
)
{
hooks
=
boolHook
;
hooks
=
boolHook
;
// Use formHook for forms and if the name contains certain characters
}
else
if
(
formHook
&&
name
!==
"className"
&&
(
jQuery
.
nodeName
(
elem
,
"form"
)
||
rinvalidChar
.
test
(
name
))
)
{
// Use formHook for forms and if the name contains certain characters
}
else
if
(
formHook
&&
name
!==
"className"
&&
(
jQuery
.
nodeName
(
elem
,
"form"
)
||
rinvalidChar
.
test
(
name
))
)
{
hooks
=
formHook
;
hooks
=
formHook
;
}
}
}
...
...
@@ -465,10 +467,11 @@ jQuery.extend({
var
ret
,
hooks
,
notxml
=
nType
!==
1
||
!
jQuery
.
isXMLDoc
(
elem
);
// Try to normalize/fix the name
name
=
notxml
&&
jQuery
.
propFix
[
name
]
||
name
;
hooks
=
jQuery
.
propHooks
[
name
];
if
(
notxml
)
{
// Fix name and attach hooks
name
=
jQuery
.
propFix
[
name
]
||
name
;
hooks
=
jQuery
.
propHooks
[
name
];
}
if
(
value
!==
undefined
)
{
if
(
hooks
&&
"set"
in
hooks
&&
(
ret
=
hooks
.
set
(
elem
,
value
,
name
))
!==
undefined
)
{
...
...
test/data/dashboard.xml
View file @
641ad802
<?xml version="1.0" encoding="UTF-8"?>
<dashboard>
<locations
class=
"foo"
>
<location
for=
"bar"
>
<location
for=
"bar"
checked=
"different"
>
<infowindowtab>
<tab
title=
"Location"
>
<![CDATA[blabla]]>
</tab>
<tab
title=
"Users"
>
<![CDATA[blublu]]>
</tab>
...
...
test/unit/attributes.js
View file @
641ad802
...
...
@@ -132,11 +132,12 @@ test("attr(String)", function() {
if
(
!
isLocal
)
{
test
(
"attr(String) in XML Files"
,
function
()
{
expect
(
2
);
expect
(
3
);
stop
();
jQuery
.
get
(
"data/dashboard.xml"
,
function
(
xml
)
{
equals
(
jQuery
(
"locations"
,
xml
).
attr
(
"class"
),
"foo"
,
"Check class attribute in XML document"
);
equals
(
jQuery
(
"location"
,
xml
).
attr
(
"for"
),
"bar"
,
"Check for attribute in XML document"
);
equal
(
jQuery
(
"locations"
,
xml
).
attr
(
"class"
),
"foo"
,
"Check class attribute in XML document"
);
equal
(
jQuery
(
"location"
,
xml
).
attr
(
"for"
),
"bar"
,
"Check for attribute in XML document"
);
equal
(
jQuery
(
"location"
,
xml
).
attr
(
"checked"
),
"different"
,
"Check that hooks are not attached in XML document"
);
start
();
});
});
...
...
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