chore(build): add IE11 to CI
This commit is contained in:
@ -1 +0,0 @@
|
||||
library angular2.test_lib.shims_for_ie;
|
87
modules/angular2/src/test_lib/shims_for_IE.js
vendored
Normal file
87
modules/angular2/src/test_lib/shims_for_IE.js
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
// function.name (all IE)
|
||||
/*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/
|
||||
if (!Object.hasOwnProperty('name')) {
|
||||
Object.defineProperty(Function.prototype, 'name', {
|
||||
get: function() {
|
||||
var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];
|
||||
// For better performance only parse once, and then cache the
|
||||
// result through a new accessor for repeated access.
|
||||
Object.defineProperty(this, 'name', {value: name});
|
||||
return name;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// URL polyfill for SystemJS (all IE)
|
||||
/*! @source https://github.com/ModuleLoader/es6-module-loader/blob/master/src/url-polyfill.js*/
|
||||
// from https://gist.github.com/Yaffle/1088850
|
||||
(function(global) {
|
||||
function URLPolyfill(url, baseURL) {
|
||||
if (typeof url != 'string') {
|
||||
throw new TypeError('URL must be a string');
|
||||
}
|
||||
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
|
||||
if (!m) {
|
||||
throw new RangeError();
|
||||
}
|
||||
var protocol = m[1] || "";
|
||||
var username = m[2] || "";
|
||||
var password = m[3] || "";
|
||||
var host = m[4] || "";
|
||||
var hostname = m[5] || "";
|
||||
var port = m[6] || "";
|
||||
var pathname = m[7] || "";
|
||||
var search = m[8] || "";
|
||||
var hash = m[9] || "";
|
||||
if (baseURL !== undefined) {
|
||||
var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill(baseURL);
|
||||
var flag = protocol === "" && host === "" && username === "";
|
||||
if (flag && pathname === "" && search === "") {
|
||||
search = base.search;
|
||||
}
|
||||
if (flag && pathname.charAt(0) !== "/") {
|
||||
pathname = (pathname !== "" ? (((base.host !== "" || base.username !== "") && base.pathname === "" ? "/" : "") + base.pathname.slice(0, base.pathname.lastIndexOf("/") + 1) + pathname) : base.pathname);
|
||||
}
|
||||
// dot segments removal
|
||||
var output = [];
|
||||
pathname.replace(/^(\.\.?(\/|$))+/, "")
|
||||
.replace(/\/(\.(\/|$))+/g, "/")
|
||||
.replace(/\/\.\.$/, "/../")
|
||||
.replace(/\/?[^\/]*/g, function (p) {
|
||||
if (p === "/..") {
|
||||
output.pop();
|
||||
} else {
|
||||
output.push(p);
|
||||
}
|
||||
});
|
||||
pathname = output.join("").replace(/^\//, pathname.charAt(0) === "/" ? "/" : "");
|
||||
if (flag) {
|
||||
port = base.port;
|
||||
hostname = base.hostname;
|
||||
host = base.host;
|
||||
password = base.password;
|
||||
username = base.username;
|
||||
}
|
||||
if (protocol === "") {
|
||||
protocol = base.protocol;
|
||||
}
|
||||
}
|
||||
|
||||
// convert windows file URLs to use /
|
||||
if (protocol == 'file:')
|
||||
pathname = pathname.replace(/\\/g, '/');
|
||||
|
||||
this.origin = protocol + (protocol !== "" || host !== "" ? "//" : "") + host;
|
||||
this.href = protocol + (protocol !== "" || host !== "" ? "//" : "") + (username !== "" ? username + (password !== "" ? ":" + password : "") + "@" : "") + host + pathname + search + hash;
|
||||
this.protocol = protocol;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.host = host;
|
||||
this.hostname = hostname;
|
||||
this.port = port;
|
||||
this.pathname = pathname;
|
||||
this.search = search;
|
||||
this.hash = hash;
|
||||
}
|
||||
global.URLPolyfill = URLPolyfill;
|
||||
})(typeof self != 'undefined' ? self : global);
|
@ -1,13 +0,0 @@
|
||||
// function.name
|
||||
/*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/
|
||||
if (!Object.hasOwnProperty('name')) {
|
||||
Object.defineProperty(Function.prototype, 'name', {
|
||||
get: function() {
|
||||
var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];
|
||||
// For better performance only parse once, and then cache the
|
||||
// result through a new accessor for repeated access.
|
||||
Object.defineProperty(this, 'name', {value: name});
|
||||
return name;
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user