Adding a prefix property to Browser/Browser.Engine #2218

Closed
ibolmo opened this Issue Jan 19, 2012 · 3 comments

4 participants

@ibolmo
MooTools member

(from Lighthouse)

Hey.
I thought it might be useful to add a prefix property to Browser, that will contain the css prefix used for the current browser.
Something like:

Browser.prefix = (Browser.Engine.gecko)
         ? 'moz' : (Browser.Engine.webkit)
         ? 'webkit' : (Browser.Engine.presto) 
         ? 'o' : 'ms';

This can be very useful for apps working with CSS3

@piotr-cz

Besides normal prefix, there is DOM prerix and CSS prefix. I don't remeber the differences now :) but I came up with this:

(function(win, doc, und){
    var prefixes = {
        "chrome"        : 'Webkit',
        "safari"        : 'Webkit',
        "konqueror"     : 'Khtml',
        "firefox"       : 'Moz',
        "ie"            : 'ms',
        "opera"         : 'O'
    };

    var domprefix       = (prefixes[win.Browser.name] || und);
    var prefix          = (domprefix.toLowerCase() || und);
    var cssprefix       = ('-' + prefix + '-' || und);

    Browser.extend({
        'prefix'        : prefix,
        'domprefix'     : domprefix,
        'cssprefix'     : cssprefix
    });

    return;

})(window, document, undefined);
@ibolmo
MooTools member

If someone writes the PR and specs, it'll help us consider adding it.

@arian
MooTools member

As browser-prefixes are continuously changing, and blink is phasing them out, I don't think we should add something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment