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
b8133e28
Commit
b8133e28
authored
Apr 30, 2014
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data: Work around IE11 bug with onpageshow attribute
Fixes #14894
parent
c34dbf5a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
data.js
src/data.js
+8
-4
dataAttrs.html
test/data/data/dataAttrs.html
+16
-0
data.js
test/unit/data.js
+6
-0
No files found.
src/data.js
View file @
b8133e28
...
@@ -87,11 +87,15 @@ jQuery.fn.extend({
...
@@ -87,11 +87,15 @@ jQuery.fn.extend({
if
(
elem
.
nodeType
===
1
&&
!
data_priv
.
get
(
elem
,
"hasDataAttrs"
)
)
{
if
(
elem
.
nodeType
===
1
&&
!
data_priv
.
get
(
elem
,
"hasDataAttrs"
)
)
{
i
=
attrs
.
length
;
i
=
attrs
.
length
;
while
(
i
--
)
{
while
(
i
--
)
{
name
=
attrs
[
i
].
name
;
if
(
name
.
indexOf
(
"data-"
)
===
0
)
{
// Support: IE11+
name
=
jQuery
.
camelCase
(
name
.
slice
(
5
)
);
// The attrs elements can be null (#14894)
dataAttr
(
elem
,
name
,
data
[
name
]
);
if
(
attrs
[
i
]
)
{
name
=
attrs
[
i
].
name
;
if
(
name
.
indexOf
(
"data-"
)
===
0
)
{
name
=
jQuery
.
camelCase
(
name
.
slice
(
5
)
);
dataAttr
(
elem
,
name
,
data
[
name
]
);
}
}
}
}
}
data_priv
.
set
(
elem
,
"hasDataAttrs"
,
true
);
data_priv
.
set
(
elem
,
"hasDataAttrs"
,
true
);
...
...
test/data/data/dataAttrs.html
0 → 100644
View file @
b8133e28
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>
IE11 onpageshow strangeness (#14894)
</title>
<script
src=
"../../jquery.js"
></script>
<script>
$
(
function
(){
window
.
parent
.
iframeCallback
(
$
(
"body"
).
data
().
result
);
});
</script>
</head>
<body
x-what=
"test"
data-result=
"ok"
onload=
"x=1"
onpageshow=
"x=1"
>
Test for #14894
</body>
</html>
test/unit/data.js
View file @
b8133e28
...
@@ -801,3 +801,9 @@ test("Check proper data removal of non-element descendants nodes (#8335)", 1, fu
...
@@ -801,3 +801,9 @@ test("Check proper data removal of non-element descendants nodes (#8335)", 1, fu
ok
(
!
text
.
data
(
"test"
),
"Be sure data is not stored in non-element"
);
ok
(
!
text
.
data
(
"test"
),
"Be sure data is not stored in non-element"
);
});
});
testIframeWithCallback
(
"enumerate data attrs on body (#14894)"
,
"data/dataAttrs.html"
,
function
(
result
)
{
expect
(
1
);
equal
(
result
,
"ok"
,
"enumeration of data- attrs on body"
);
});
\ No newline at end of file
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