mapping styles (v12)

Revision 12 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/mootools/1.3/mootools-yui-compressed.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
map all
(function(){
        
var styles = { js: {}, css: {} };
var hasPrefix = /(moz-|ms-|webkit-|o-)([\w-]+)/;

Object.each(document.body.currentStyle || window.getComputedStyle(document.body), function(value, key){
        var dashed = isNaN(key) ? key.hyphenate() : value,
                prefix = hasPrefix.exec(dashed) || [],
                name = prefix[2] || dashed;
        styles.css[name] = [prefix[0] ? '-' + prefix[0] : dashed];
        styles.js[name.camelCase()] = [prefix[1] == 'ms-' ? key : dashed.camelCase()];
});

})();
ready
map some
var test = true;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.