Giter VIP home page Giter VIP logo

Comments (5)

stephband avatar stephband commented on June 26, 2024

Oh yeah. I polyfill Symbol, normally, but you're right, I probably shouldn't assume it's existence here.

This code replaces symbols with strings (via .toString when setting the symbol property). It's not a polyfill, but it will get things working in IE:

if (!window.Symbol) {
    (function(window){
        "use strict";

        var defineProperty = Object.defineProperty;
        var prefix = '__symbol-' + Math.ceil(Math.random() * 1000000000) + '-';
        var id = 0;

        function Symbol(description) {
            if (!(this instanceof Symbol)) { return new Symbol(description); }
            var symbol = prefix + id++;
            this._symbol = symbol;
        }

        defineProperty(Symbol.prototype, 'toString', {
            enumerable: false,
            configurable: false,
            writable: false,
            value: function toString() {
                return this._symbol;
            }
        });

        window.Symbol = Symbol;
    }(this));
}

from jquery.event.move.

4rn0 avatar 4rn0 commented on June 26, 2024

Works like a charm! Thanks!

from jquery.event.move.

szamanr avatar szamanr commented on June 26, 2024

@stephband i'm still getting this problem and my app is not running on IE11. could you release a solution as a commit?

i am using jquery.event.move 2.0.0 and jquery 3.3.1.

from jquery.event.move.

andreszs avatar andreszs commented on June 26, 2024

Oh yeah. I polyfill Symbol, normally, but you're right, I probably shouldn't assume it's existence here.

This code replaces symbols with strings (via .toString when setting the symbol property). It's not a polyfill, but it will get things working in IE:

if (!window.Symbol) {
    (function(window){
        "use strict";

        var defineProperty = Object.defineProperty;
        var prefix = '__symbol-' + Math.ceil(Math.random() * 1000000000) + '-';
        var id = 0;

        function Symbol(description) {
            if (!(this instanceof Symbol)) { return new Symbol(description); }
            var symbol = prefix + id++;
            this._symbol = symbol;
        }

        defineProperty(Symbol.prototype, 'toString', {
            enumerable: false,
            configurable: false,
            writable: false,
            value: function toString() {
                return this._symbol;
            }
        });

        window.Symbol = Symbol;
    }(this));
}

Adding this effectively disables vertical scroll in both Internet Explorer 11 Mobile and Edge Mobile (that is, the complete Windows Phone and Windows Mobile device family).

I'll never understand that obsession with the implementation of ES 2015 (and newer) functions with the only goal of rendering scripts unusable in older browsers. Please remember that not everyone can acquire a 1300 USD iPhone device to use the methods from ECMA Script 2020... it's the other way around: scripts must work in older devices whenever possible. Do not take this as a personal attack to the plugin developers, this is just a suggestion.

from jquery.event.move.

Nukro avatar Nukro commented on June 26, 2024

Oh yeah. I polyfill Symbol, normally, but you're right, I probably shouldn't assume it's existence here.

This code replaces symbols with strings (via .toString when setting the symbol property). It's not a polyfill, but it will get things working in IE:

if (!window.Symbol) {
    (function(window){
        "use strict";

        var defineProperty = Object.defineProperty;
        var prefix = '__symbol-' + Math.ceil(Math.random() * 1000000000) + '-';
        var id = 0;

        function Symbol(description) {
            if (!(this instanceof Symbol)) { return new Symbol(description); }
            var symbol = prefix + id++;
            this._symbol = symbol;
        }

        defineProperty(Symbol.prototype, 'toString', {
            enumerable: false,
            configurable: false,
            writable: false,
            value: function toString() {
                return this._symbol;
            }
        });

        window.Symbol = Symbol;
    }(this));
}

Where to place that code?

from jquery.event.move.

Related Issues (20)

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.