1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-07 18:07:25 +03:00
This commit is contained in:
Kegan Dougal
2015-12-10 14:57:13 +00:00
parent f08152a1d8
commit 8576ebce8f
3 changed files with 41 additions and 23 deletions

View File

@@ -371,7 +371,7 @@ module.exports.runPolyfills = function() {
// Array.prototype.forEach
// ========================================================
// SOURCE:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
// Production steps of ECMA-262, Edition 5, 15.4.4.18
// Reference: http://es5.github.io/#x15.4.4.18
if (!Array.prototype.forEach) {
@@ -380,14 +380,15 @@ module.exports.runPolyfills = function() {
var T, k;
if (this == null) {
if (this === null || this === undefined) {
throw new TypeError(' this is null or not defined');
}
// 1. Let O be the result of calling ToObject passing the |this| value as the argument.
var O = Object(this);
// 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
// 2. Let lenValue be the result of calling the Get internal method of O with the
// argument "length".
// 3. Let len be ToUint32(lenValue).
var len = O.length >>> 0;
@@ -412,12 +413,14 @@ module.exports.runPolyfills = function() {
// a. Let Pk be ToString(k).
// This is implicit for LHS operands of the in operator
// b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
// b. Let kPresent be the result of calling the HasProperty internal
// method of O with
// argument Pk.
// This step can be combined with c
// c. If kPresent is true, then
if (k in O) {
// i. Let kValue be the result of calling the Get internal method of O with argument Pk.
// i. Let kValue be the result of calling the Get internal method of O with argument Pk
kValue = O[k];
// ii. Call the Call internal method of callback with T as the this value and