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

ibolmo opened this Issue Jan 19, 2012 · 3 comments

4 participants

MooTools member

(from Lighthouse)

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


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[] || und);
    var prefix          = (domprefix.toLowerCase() || und);
    var cssprefix       = ('-' + prefix + '-' || und);

        'prefix'        : prefix,
        'domprefix'     : domprefix,
        'cssprefix'     : cssprefix


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

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

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