mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
chore(): begin adding ionic components to mono-repo.
This commit is contained in:
59
packages/ionic-angular/scripts/polyfill/polyfill.dom.js
Normal file
59
packages/ionic-angular/scripts/polyfill/polyfill.dom.js
Normal file
@ -0,0 +1,59 @@
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
if (typeof Element.prototype.matches !== 'function') {
|
||||
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector || function matches(selector) {
|
||||
var element = this;
|
||||
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
|
||||
var index = 0;
|
||||
while (elements[index] && elements[index] !== element) {
|
||||
++index;
|
||||
}
|
||||
return Boolean(elements[index]);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (typeof Element.prototype.closest !== 'function') {
|
||||
Element.prototype.closest = function closest(selector) {
|
||||
var element = this;
|
||||
while (element && element.nodeType === 1) {
|
||||
if (element.matches(selector)) {
|
||||
return element;
|
||||
}
|
||||
element = element.parentNode;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
|
||||
// MIT license
|
||||
var win = window;
|
||||
if (!win.requestAnimationFrame) {
|
||||
win.requestAnimationFrame = win.webkitRequestAnimationFrame;
|
||||
win.cancelAnimationFrame = win.webkitCancelAnimationFrame || win.webkitCancelRequestAnimationFrame;
|
||||
|
||||
if (!win.requestAnimationFrame) {
|
||||
win.requestAnimationFrame = function(callback, element) {
|
||||
var currTime = new Date().getTime();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
|
||||
var id = win.setTimeout(function() {
|
||||
callback(currTime + timeToCall);
|
||||
}, timeToCall);
|
||||
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
}
|
||||
|
||||
if (!win.cancelAnimationFrame) {
|
||||
win.cancelAnimationFrame = function(id) {
|
||||
clearTimeout(id);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
56
packages/ionic-angular/scripts/polyfill/readme.md
Normal file
56
packages/ionic-angular/scripts/polyfill/readme.md
Normal file
@ -0,0 +1,56 @@
|
||||
## polyfills.js
|
||||
|
||||
Contains all polyfills needed to work on the largest range of devices. This is the default polyfill.
|
||||
|
||||
### Targets:
|
||||
|
||||
- Android 4.4.2 and above
|
||||
- iOS back to iOS 8
|
||||
|
||||
### Includes:
|
||||
|
||||
- All ES6 features
|
||||
- zone.js
|
||||
- ES7 reflection
|
||||
|
||||
|
||||
## polyfills.modern.js
|
||||
|
||||
A limited of set of polyfills to work on more modern browsers. This file limits the number of ES6 polyfills which are already natively included in modern browsers.
|
||||
|
||||
### Targets:
|
||||
|
||||
- Android 5.0 and above
|
||||
- iOS 9 and above
|
||||
|
||||
### Includes:
|
||||
|
||||
- zone.js
|
||||
- ES7 reflection,
|
||||
- ES6 polyfills, except for:
|
||||
|
||||
new regexp features,
|
||||
math features,
|
||||
symbols,
|
||||
typed arrays,
|
||||
weak maps / weak sets
|
||||
|
||||
|
||||
## polyfills.ng.js
|
||||
|
||||
Only the required polyfill for Angular. This does not come with any ES6 polyfills. Note that all polyfill files listed here included the required polyfills for Angular to work correctly.
|
||||
|
||||
### Targets:
|
||||
|
||||
- Android 5.0 and above
|
||||
- iOS 10 and above
|
||||
|
||||
### Includes:
|
||||
|
||||
- zone.js
|
||||
- ES7 reflection
|
||||
|
||||
|
||||
## ECMAScript 6 Compatibility
|
||||
|
||||
To easily judge which polyfill you may need you can check this [ES6 support table](https://kangax.github.io/compat-table/es6/).
|
Reference in New Issue
Block a user