mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
added .keys method to objects, if not supported, fixes IE issue with pluginfw
This commit is contained in:
parent
0e731a2645
commit
d0dd746c8b
2 changed files with 12 additions and 2 deletions
|
@ -47,7 +47,7 @@ function extend(obj, props)
|
||||||
var forEachImpl = function(fn){
|
var forEachImpl = function(fn){
|
||||||
for (var i = 0; i < this.length; i++)
|
for (var i = 0; i < this.length; i++)
|
||||||
{
|
{
|
||||||
var result = func(this[i], i, this);
|
var result = fn(this[i], i, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,11 +64,19 @@ function mapImpl(fn)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// From underscore.js
|
||||||
|
var keysImpl =function(obj) {
|
||||||
|
if (obj !== Object(obj)) throw new TypeError('Invalid object');
|
||||||
|
var keys = [];
|
||||||
|
for (var key in obj) if (obj.hasOwnProperty(key)) keys.push(key);
|
||||||
|
|
||||||
|
return keys;
|
||||||
|
};
|
||||||
|
|
||||||
Array.prototype.forEach = Array.prototype.forEach || forEachImpl;
|
Array.prototype.forEach = Array.prototype.forEach || forEachImpl;
|
||||||
Array.prototype.each = Array.prototype.each || forEachImpl;
|
Array.prototype.each = Array.prototype.each || forEachImpl;
|
||||||
Array.prototype.map = Array.prototype.map || mapImpl;
|
Array.prototype.map = Array.prototype.map || mapImpl;
|
||||||
|
Object.keys = Object.keys || keysImpl;
|
||||||
|
|
||||||
function isArray(testObject)
|
function isArray(testObject)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,8 @@ if (!exports.isClient) {
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var tsort = require("./tsort");
|
var tsort = require("./tsort");
|
||||||
var util = require("util");
|
var util = require("util");
|
||||||
|
}else{
|
||||||
|
require("../ace2_common.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.prefix = 'ep_';
|
exports.prefix = 'ep_';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue