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
8c1d8429
Commit
8c1d8429
authored
Apr 04, 2015
by
Timmy Willison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Core: add workaround for iOS JIT error in isArrayLike
Fixes gh-2145
parent
852529c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
core.js
src/core.js
+6
-1
core.js
test/unit/core.js
+21
-0
No files found.
src/core.js
View file @
8c1d8429
...
...
@@ -516,7 +516,12 @@ jQuery.each("Boolean Number String Function Array Date RegExp Object Error".spli
});
function
isArraylike
(
obj
)
{
var
length
=
obj
.
length
,
// Support: iOS 8.2 (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
var
length
=
"length"
in
obj
&&
obj
.
length
,
type
=
jQuery
.
type
(
obj
);
if
(
type
===
"function"
||
jQuery
.
isWindow
(
obj
)
)
{
...
...
test/unit/core.js
View file @
8c1d8429
...
...
@@ -1201,6 +1201,27 @@ test("jQuery.each(Object,Function)", function() {
equal
(
i
,
2
,
"Iteration over document.styleSheets"
);
});
test
(
"JIT compilation does not interfere with length retrieval (gh-2145)"
,
function
()
{
expect
(
4
);
var
i
;
// Trigger JIT compilation of jQuery.each – and therefore isArraylike – in iOS.
// Convince JSC to use one of its optimizing compilers
// by providing code which can be LICM'd into nothing.
for
(
i
=
0
;
i
<
1000
;
i
++
)
{
jQuery
.
each
(
[]
);
}
i
=
0
;
jQuery
.
each
(
{
1
:
"1"
,
2
:
"2"
,
3
:
"3"
},
function
(
index
)
{
equal
(
++
i
,
index
,
"Iteration over object with solely "
+
"numeric indices (gh-2145 JIT iOS 8 bug)"
);
});
equal
(
i
,
3
,
"Iteration over object with solely "
+
"numeric indices (gh-2145 JIT iOS 8 bug)"
);
});
test
(
"jQuery.makeArray"
,
function
(){
expect
(
15
);
...
...
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