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

Commit 269e918

Browse files
committed
build 0.5.1
1 parent 0e55fa9 commit 269e918

12 files changed

+73
-51
lines changed

dev/jscore-ie10.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jsCore JavaScript library v0.5.0 IE10+
1+
/* jsCore JavaScript library v0.5.1 IE10+
22
* © 2014 Dmitry Korobkin
33
* Released under the MIT license
44
* github.com/Octane/jsCore
@@ -62,12 +62,9 @@ if (!Object.setPrototypeOf) {
6262
};
6363
}
6464

65+
//bugs.ecmascript.org/show_bug.cgi?id=2435
6566
if (!Array.from) {
6667
Array.from = function (iterable, func, boundThis) {
67-
if (!Object(iterable).length) {
68-
//bugs.ecmascript.org/show_bug.cgi?id=2435
69-
return [];
70-
}
7168
if (func) {
7269
return Array.map(iterable, func, boundThis);
7370
}

dev/jscore-ie9.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jsCore JavaScript library v0.5.0 IE9+
1+
/* jsCore JavaScript library v0.5.1 IE9+
22
* © 2014 Dmitry Korobkin
33
* Released under the MIT license
44
* github.com/Octane/jsCore
@@ -62,12 +62,9 @@ if (!Object.setPrototypeOf) {
6262
};
6363
}
6464

65+
//bugs.ecmascript.org/show_bug.cgi?id=2435
6566
if (!Array.from) {
6667
Array.from = function (iterable, func, boundThis) {
67-
if (!Object(iterable).length) {
68-
//bugs.ecmascript.org/show_bug.cgi?id=2435
69-
return [];
70-
}
7168
if (func) {
7269
return Array.map(iterable, func, boundThis);
7370
}

dev/jscore-polyfill-ie10.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jsCore JavaScript polyfill v0.5.0 IE10+
1+
/* jsCore JavaScript polyfill v0.5.1 IE10+
22
* © 2014 Dmitry Korobkin
33
* Released under the MIT license
44
* github.com/Octane/jsCore
@@ -62,12 +62,9 @@ if (!Object.setPrototypeOf) {
6262
};
6363
}
6464

65+
//bugs.ecmascript.org/show_bug.cgi?id=2435
6566
if (!Array.from) {
6667
Array.from = function (iterable, func, boundThis) {
67-
if (!Object(iterable).length) {
68-
//bugs.ecmascript.org/show_bug.cgi?id=2435
69-
return [];
70-
}
7168
if (func) {
7269
return Array.map(iterable, func, boundThis);
7370
}

dev/jscore-polyfill-ie9.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jsCore JavaScript polyfill v0.5.0 IE9+
1+
/* jsCore JavaScript polyfill v0.5.1 IE9+
22
* © 2014 Dmitry Korobkin
33
* Released under the MIT license
44
* github.com/Octane/jsCore
@@ -62,12 +62,9 @@ if (!Object.setPrototypeOf) {
6262
};
6363
}
6464

65+
//bugs.ecmascript.org/show_bug.cgi?id=2435
6566
if (!Array.from) {
6667
Array.from = function (iterable, func, boundThis) {
67-
if (!Object(iterable).length) {
68-
//bugs.ecmascript.org/show_bug.cgi?id=2435
69-
return [];
70-
}
7168
if (func) {
7269
return Array.map(iterable, func, boundThis);
7370
}

dev/jscore-polyfill.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jsCore JavaScript polyfill v0.5.0 IE8+
1+
/* jsCore JavaScript polyfill v0.5.1 IE8+
22
* © 2014 Dmitry Korobkin
33
* Released under the MIT license
44
* github.com/Octane/jsCore
@@ -433,12 +433,9 @@ if (!Object.setPrototypeOf) {
433433
};
434434
}
435435

436+
//bugs.ecmascript.org/show_bug.cgi?id=2435
436437
if (!Array.from) {
437438
Array.from = function (iterable, func, boundThis) {
438-
if (!Object(iterable).length) {
439-
//bugs.ecmascript.org/show_bug.cgi?id=2435
440-
return [];
441-
}
442439
if (func) {
443440
return Array.map(iterable, func, boundThis);
444441
}
@@ -1858,19 +1855,39 @@ new function () {
18581855
return result;
18591856
}
18601857

1858+
function isString(anything) {
1859+
return '[object String]' == Object.prototype.toString.call(anything);
1860+
}
1861+
18611862
try {
18621863
//array methods don't work with array-like DOM-objects in IE8
18631864
Array.slice(document.documentElement.childNodes, 0);
18641865
} catch (error) {
18651866
Array.slice = function (iterable, start, end) {
18661867
var result,
1867-
length = arguments.length;
1868-
//NodeList instanceof Object → false in IE8
1869-
if (Object(iterable) instanceof Object) {
1870-
result = iterable;
1868+
length;
1869+
if (null === iterable) {
1870+
throw TypeError("can't convert null to object");
1871+
}
1872+
if (undefined === iterable) {
1873+
throw TypeError("can't convert undefined to object");
1874+
}
1875+
if (Number.isNaN(iterable)) {
1876+
return [];
1877+
}
1878+
if (isString(iterable)) {
1879+
result = iterable.split('');
18711880
} else {
1881+
result = Object(iterable);
1882+
if (!result.length) {
1883+
result.length = 0;
1884+
}
1885+
}
1886+
//NodeList instanceof Object → false in IE8
1887+
if (!(result instanceof Object)) {
18721888
result = toArray(iterable);
18731889
}
1890+
length = arguments.length
18741891
//[1].slice(0, undefined) → [] in IE8
18751892
if (1 == length || 2 == length && 0 == start) {
18761893
return result == iterable ? slice.call(result, 0) : result;

dev/jscore.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* jsCore JavaScript library v0.5.0 IE8+
1+
/* jsCore JavaScript library v0.5.1 IE8+
22
* © 2014 Dmitry Korobkin
33
* Released under the MIT license
44
* github.com/Octane/jsCore
@@ -433,12 +433,9 @@ if (!Object.setPrototypeOf) {
433433
};
434434
}
435435

436+
//bugs.ecmascript.org/show_bug.cgi?id=2435
436437
if (!Array.from) {
437438
Array.from = function (iterable, func, boundThis) {
438-
if (!Object(iterable).length) {
439-
//bugs.ecmascript.org/show_bug.cgi?id=2435
440-
return [];
441-
}
442439
if (func) {
443440
return Array.map(iterable, func, boundThis);
444441
}
@@ -1858,19 +1855,39 @@ new function () {
18581855
return result;
18591856
}
18601857

1858+
function isString(anything) {
1859+
return '[object String]' == Object.prototype.toString.call(anything);
1860+
}
1861+
18611862
try {
18621863
//array methods don't work with array-like DOM-objects in IE8
18631864
Array.slice(document.documentElement.childNodes, 0);
18641865
} catch (error) {
18651866
Array.slice = function (iterable, start, end) {
18661867
var result,
1867-
length = arguments.length;
1868-
//NodeList instanceof Object → false in IE8
1869-
if (Object(iterable) instanceof Object) {
1870-
result = iterable;
1868+
length;
1869+
if (null === iterable) {
1870+
throw TypeError("can't convert null to object");
1871+
}
1872+
if (undefined === iterable) {
1873+
throw TypeError("can't convert undefined to object");
1874+
}
1875+
if (Number.isNaN(iterable)) {
1876+
return [];
1877+
}
1878+
if (isString(iterable)) {
1879+
result = iterable.split('');
18711880
} else {
1881+
result = Object(iterable);
1882+
if (!result.length) {
1883+
result.length = 0;
1884+
}
1885+
}
1886+
//NodeList instanceof Object → false in IE8
1887+
if (!(result instanceof Object)) {
18721888
result = toArray(iterable);
18731889
}
1890+
length = arguments.length
18741891
//[1].slice(0, undefined) → [] in IE8
18751892
if (1 == length || 2 == length && 0 == start) {
18761893
return result == iterable ? slice.call(result, 0) : result;

min/jscore-ie10.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

min/jscore-ie9.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

min/jscore-polyfill-ie10.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)