mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 09:26:37 +00:00
2ee1514552
Change-Id: I50346029a9bd8a7d2cf954b0cca011f73a6fae07
20 lines
570 B
JavaScript
20 lines
570 B
JavaScript
/**
|
|
* Progressive enhancement for JS core- define things that are scheduled to
|
|
* appear in the standard anyway.
|
|
*/
|
|
|
|
if(!Array.prototype.last) Object.defineProperty(Array.prototype, 'last', {
|
|
value: function() { return this[this.length - 1] }
|
|
});
|
|
|
|
/** Good-old monkey-patching to let us merge properties of another object into this one. */
|
|
if(!Object.prototype.mergeProperties) Object.defineProperty(Object.prototype, 'mergeProperties', {
|
|
value: function (o) {
|
|
var self = this;
|
|
Object.keys(o).forEach(function(k) {
|
|
self[k] = o[k];
|
|
});
|
|
return this;
|
|
}
|
|
});
|