Mootools

Benchmark created on


Preparation HTML

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

Setup

var HtmlElement = new Class({
      initialize: function(element, properties) {
        var type = typeOf(element);
    
        if (type == 'element') {
          this._el = element;
        } else {
          this._el = new Element(element, properties);
        }
      },
    
      set: function(property, value) {
        return this._el.set(property, value);
      },
    
      get: function(property) {
        return this._el.get(property);
      },
    
      inject: function(el, where) {
        return this._el.inject(el, where);
      },
    
      grab: function(el, where) {
        return this._el.grab(el, where);
      },
    
      getStyle: function(property) {
        return this._el.getStyle(property);
      },
    
      setStyle: function(property, value) {
        return this._el.setStyle(property, value);
      },
    
      getStyles: function(styles) {
        return this._el.getStyles(styles);
      },
    
      setStyles: function(styles) {
        return this._el.setStyles(styles);
      },
    
      getCoordinates: function() {
        return this._el.getCoordinates();
      },
    
      addEvent: function(type, fn) {
        return this._el.addEvent(type, fn);
      },
    
      fireEvent: function(type, args, delay) {
        return this._el.fireEvent(type, args, delay);
      },
    
      getParent: function() {
        return this._el.getParent();
      },
    
      getChildren: function(selector) {
        return this._el.getChildren(selector);
      },
    
      getElement: function(tag) {
        return this._el.getElement(tag);
      },
    
      getProperty: function(property) {
        return this._el.getProperty(property);
      },
    
      getChildren: function() {
        return this._el.getChildren();
      },
    
      getSize: function() {
        return this._el.getSize();
      },
    
      getScrollSize: function() {
        return this._el.getScrollSize();
      },
    
      hasClass: function(className) {
        return this._el.hasClass(className);
      },
    
      addClass: function(className) {
        return this._el.addClass(className);
      },
    
      removeClass: function(className) {
        return this._el.removeClass(className);
      },
    
      store: function(key, value) {
        return this._el.store(key, value);
      },
    
      retrieve: function(key, value) {
        return this._el.retrieve(key, value);
      },
    
      fade: function(how) {
        return this._el.fade(how);
      },
    
      destroy: function() {
        return this._el.destroy();
      },
    
      toElement: function() {
        return this._el;
      },
    
      setPosition: function(positions) {
        return this._el.setPosition(positions);
      },
    
      focus: function() {
        this._el.focus();
      },
    
      hide: function() {
        this._el.setStyle('display', 'none');
      },
    
      show: function() {
        this._el.setStyle('display', '');
      }
    });

Test runner

Ready to run.

Testing in
TestOps/sec
Element
var el = new Element('div');
ready
HtmlElement
var el = new HtmlElement('div');
ready

Revisions

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