zoukankan      html  css  js  c++  java
  • Angular8 ie兼容性解决

    启用腻子脚本 polyfills.ts

    /* IE9, IE10 and IE11 requires all of the following polyfills. */
    import 'core-js/es6/symbol';
    import 'core-js/es6/object';
    import 'core-js/es6/function';
    import 'core-js/es6/parse-int';
    import 'core-js/es6/parse-float';
    import 'core-js/es6/number';
    import 'core-js/es6/math';
    import 'core-js/es6/string';
    import 'core-js/es6/date';
    import 'core-js/es6/array';
    import 'core-js/es6/regexp';
    import 'core-js/es6/map';
    import 'core-js/es6/weak-map';
    import 'core-js/es6/set';
    
    import 'core-js/es7/array';
    
    /** IE10 and IE11 requires the following for the Reflect API. */
    import 'core-js/es6/reflect';
    
    /* Evergreen browsers require these. */
    // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
    import 'core-js/es7/reflect';
    
    /** IE10 and IE11 requires the following for NgClass support on SVG elements */
    import 'classlist.js'; // Run `npm install --save classlist.js`.
    
    /**
     * Web Animations `@angular/platform-browser/animations`
     * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
     * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
     */
    import 'web-animations-js'; // Run `npm install --save web-animations-js`.
    import 'zone.js/dist/zone'; // Included with Angular CLI.
    // This polyfill adds compatibility to all Browsers supporting ES5:
    if ((window as any).NodeList && !NodeList.prototype.forEach) {
      NodeList.prototype.forEach = function(callback, thisArg) {
        thisArg = thisArg || window;
        for (let i = 0; i < this.length; i++) {
          callback.call(thisArg, this[i], i, this);
        }
      };
    }
    
    // 解决ie下报错 对象不支持matches
    if (!Element.prototype.matches) {
      Element.prototype.matches =
        (Element.prototype as any).matchesSelector ||
        (Element.prototype as any).mozMatchesSelector ||
        (Element.prototype as any).msMatchesSelector ||
        (Element.prototype as any).oMatchesSelector ||
        Element.prototype.webkitMatchesSelector ||
        function(s) {
          const matches = (this.document || this.ownerDocument).querySelectorAll(s);
          let i = matches.length;
          while (--i >= 0 && matches.item(i) !== this) {}
          return i > -1;
        };
    }
    
  • 相关阅读:
    来深圳两月有余
    Recording Audio on Android with Examples
    How to Use the Zmanim API
    KosherJava Zmanim API / Library
    Wt, C++ Web Toolkit
    TreeFrog Framework : High-speed C++ MVC Framework for Web Application
    QDjango, a Qt-based C++ web framework
    Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
    CivetWeb. Embedded C/C++ web server
    Tufão
  • 原文地址:https://www.cnblogs.com/honkerzh/p/11344653.html
Copyright © 2011-2022 走看看