Commit 420b5200 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Sync with upstream

parent 72e55192
......@@ -301,6 +301,13 @@ MochiKit.Base.update(MochiKit.DOM, {
if (typeof(node) == 'undefined' || node === null) {
return null;
}
// this is a safari childNodes object, avoiding crashes w/ attr
// lookup
if (typeof(node) == "function" &&
typeof(node.length) == "number" &&
!(node instanceof Function)) {
node = im.list(node);
}
if (typeof(node.nodeType) != 'undefined' && node.nodeType > 0) {
return node;
}
......
......@@ -415,11 +415,19 @@ MochiKit.Base.update(MochiKit.Iter, {
/** @id MochiKit.Iter.list */
list: function (iterable) {
// Fast-path for Array and Array-like
var m = MochiKit.Base;
if (typeof(iterable.slice) == 'function') {
var rval;
if (iterable instanceof Array) {
return iterable.slice();
} else if (m.isArrayLike(iterable)) {
return m.concat(iterable);
}
// this is necessary to avoid a Safari crash
if (typeof(iterable) == "function" &&
!(iterable instanceof Function) &&
typeof(iterable.length) == 'number') {
rval = [];
for (var i = 0; i < iterable.length; i++) {
rval.push(iterable[i]);
}
return rval;
}
var self = MochiKit.Iter;
......
......@@ -244,3 +244,15 @@ MochiKit.Base.update(MochiKit.Position, {
return new MochiKit.Style.Coordinates(valueL, valueT);
}
});
MochiKit.Position.__new__ = function (win) {
var m = MochiKit.Base;
this.EXPORT_TAGS = {
':common': this.EXPORT,
':all': m.concat(this.EXPORT, this.EXPORT_OK)
};
m.nameFunctions(this);
};
MochiKit.Position.__new__(this);
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment