Giter Site home page Giter Site logo

Comments (5)

kimmobrunfeldt avatar kimmobrunfeldt commented on August 15, 2024

Hmm, that should be already done.

I set translate(-50%, -50%) with utils.setStyle function which deals with browser prefixes:

// element is <p>
utils.setStyle(element, 'transform', 'translate(-50%, -50%)');

utils.js

var PREFIXES = 'webkit moz o ms'.split(' ');
function setStyle(element, style, value) {
    for (var i = 0; i < PREFIXES.length; ++i) {
        var prefix = capitalize(PREFIXES[i]);
        element.style[prefix + capitalize(style)] = value;
    }

    element.style[style] = value;
}

so it will set:

element.style[msTransform] = 'translate(-50%, -50%)'

from progressbar.js.

AmazingDreams avatar AmazingDreams commented on August 15, 2024

I added a console.log(JSON.stringify(element.style) there and it outputs:

{"0":"position","1":"top","2":"left","3":"padding-top","4":"padding-right-value","5":"padding-bottom","6":"padding-left-value","7":"padding-left-ltr-source","8":"padding-left-rtl-source","9":"padding-right-ltr-source","10":"padding-right-rtl-source","11":"margin-top","12":"margin-right-value","13":"margin-bottom","14":"margin-left-value","15":"margin-left-ltr-source","16":"margin-left-rtl-source","17":"margin-right-ltr-source","18":"margin-right-rtl-source","19":"transform","WebkitTransform":"translate(-50%, -50%)","OTransform":"translate(-50%, -50%)","MsTransform":"translate(-50%, -50%)}

Note the "MsTransform":"translate(-50%, -50%). Are those capitalizations later turned into html style notations? (ie. MsTransform -> -ms-transform)

from progressbar.js.

kimmobrunfeldt avatar kimmobrunfeldt commented on August 15, 2024

Yes the browser prefixes are added like that in JS. Now that I think of it, it might be that ms was an exception in the naming convention

from progressbar.js.

AmazingDreams avatar AmazingDreams commented on August 15, 2024

How can they not be :)

from progressbar.js.

kimmobrunfeldt avatar kimmobrunfeldt commented on August 15, 2024

Fixed in release 0.8.1: https://github.com/kimmobrunfeldt/progressbar.js/releases/tag/0.8.1

from progressbar.js.

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.