GithubHelp home page GithubHelp logo

能兼容 IE 9 吗? about bplayer HOT 4 CLOSED

 avatar commented on June 8, 2024
能兼容 IE 9 吗?

from bplayer.

Comments (4)

ClassicOldSong avatar ClassicOldSong commented on June 8, 2024

@kurubot IE9应该是没什么问题的,不过需要添加classList的polyfill

from bplayer.

ClassicOldSong avatar ClassicOldSong commented on June 8, 2024

https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
这里的polyfill可以直接拿过来用
https://github.com/yola/classlist-polyfill
这个也行

from bplayer.

 avatar commented on June 8, 2024

噗,我们想到一块去了……

刚试了一下,加上 polyfill 后 IE 9 可以正常使用了。

// src: http://blog.csdn.net/qq_18271353/article/details/53893664
if (!("classList" in document.documentElement)) {
    Object.defineProperty(HTMLElement.prototype, 'classList', {
        get: function() {
            var self = this;
            function update(fn) {
                return function(value) {
                    var classes = self.className.split(/\s+/g),
                        index = classes.indexOf(value);

                    fn(classes, index, value);
                    self.className = classes.join(" ");
                }
            }

            return {
                add: update(function(classes, index, value) {
                    if (!~index) classes.push(value);
                }),

                remove: update(function(classes, index) {
                    if (~index) classes.splice(index, 1);
                })
            };
        }
    });
}

from bplayer.

ClassicOldSong avatar ClassicOldSong commented on June 8, 2024

能用就好~

from bplayer.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.