Skip to content
This repository was archived by the owner on Aug 21, 2022. It is now read-only.

Commit 0e55fa9

Browse files
committed
wontfix bugs.ecmascript.org/show_bug.cgi?id=2435
https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-01/jan-28.md #arrayfrom
1 parent 2dfedae commit 0e55fa9

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jsCore",
33
"main": "jscore.js",
4-
"version": "0.5.0",
4+
"version": "0.5.1",
55
"description": "Complex JavaScript polyfill and set of methods",
66
"keywords": [
77
"browser",

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#jsCore changelog
22

3+
##v0.5.1
4+
5+
- wontfix [bug 2435](https://bugs.ecmascript.org/show_bug.cgi?id=2435)
6+
37
##v0.5.0
48

59
- removed `.query()` and `.queryAll()` methods ([excluded from the W3C DOM 4 editor's draft](https://github.com/w3c/dom/commit/26355318c1013ea13c9d209665d14d2c13e28827))

src/polyfill/array.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
'use strict';
22

3+
//bugs.ecmascript.org/show_bug.cgi?id=2435
34
if (!Array.from) {
45
Array.from = function (iterable, func, boundThis) {
5-
if (!Object(iterable).length) {
6-
//bugs.ecmascript.org/show_bug.cgi?id=2435
7-
return [];
8-
}
96
if (func) {
107
return Array.map(iterable, func, boundThis);
118
}

src/polyfill/ltie10/ie8/fix/slice.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,39 @@ new function () {
1515
return result;
1616
}
1717

18+
function isString(anything) {
19+
return '[object String]' == Object.prototype.toString.call(anything);
20+
}
21+
1822
try {
1923
//array methods don't work with array-like DOM-objects in IE8
2024
Array.slice(document.documentElement.childNodes, 0);
2125
} catch (error) {
2226
Array.slice = function (iterable, start, end) {
2327
var result,
24-
length = arguments.length;
25-
//NodeList instanceof Object → false in IE8
26-
if (Object(iterable) instanceof Object) {
27-
result = iterable;
28+
length;
29+
if (null === iterable) {
30+
throw TypeError("can't convert null to object");
31+
}
32+
if (undefined === iterable) {
33+
throw TypeError("can't convert undefined to object");
34+
}
35+
if (Number.isNaN(iterable)) {
36+
return [];
37+
}
38+
if (isString(iterable)) {
39+
result = iterable.split('');
2840
} else {
41+
result = Object(iterable);
42+
if (!result.length) {
43+
result.length = 0;
44+
}
45+
}
46+
//NodeList instanceof Object → false in IE8
47+
if (!(result instanceof Object)) {
2948
result = toArray(iterable);
3049
}
50+
length = arguments.length
3151
//[1].slice(0, undefined) → [] in IE8
3252
if (1 == length || 2 == length && 0 == start) {
3353
return result == iterable ? slice.call(result, 0) : result;

0 commit comments

Comments
 (0)