MediaWiki:LAPI.js: Difference between revisions
Content deleted Content added
Fix Function.prototype.bind polyfill - https://phabricator.wikimedia.org/T70235#1096456 |
Fix newline after return; kudos to User:Dudemanfellabra for spotting this |
||
Line 73:
{
return Object.mergeSome
(from, into, includeInherited, function (src, tgt, key) {return src[key] !== null;});
};
/** String enhancements (Javascript 1.6) ************/
Line 111:
// Returns true if the string begins with prefix.
String.prototype.startsWith = function (prefix) {
return this.indexOf (prefix) === 0;
};
Line 134:
return this.replace (/([\\\'\"]|%5C|%27|%22)/g, '\\$1') // ' // Fix syntax coloring
.replace (/\n/g, '\\n');
};
// Escape all RegExp special characters such that the result can be safely used
Line 468:
if (name || msg) {
if (!asDOM) {
return (
'Exception ' + name + ': ' + msg
+ (file ? '\nFile ' + file + (line ? ' (' + line + ')' : "") : "")
);
} else {
var ex_msg = LAPI.make ('div');
Line 873:
{ // Gecko etc.
if (property == 'cssFloat') property = 'float';
▲ element.ownerDocument.defaultView.getComputedStyle (element, null).getPropertyValue (property);
} else {
var result;
|