JSFiddle - React, Tailwind, and code Playground

by rpflorence

HTML

<ul>
    <li>one</li>
    <li>two</li>
</ul>

JavaScript

Element.implement({
    set: function(prop, value){
        switch ($type(prop)){
            case 'object':
                for (var p in prop) this.set(p, prop[p]);
                break;
            case 'string':
                var property = Element.Properties.get(prop);
                value = ($type(value) == 'function') ? value(1) : value; // here
                (property && property.set) ? 
                    property.set.apply(this, Array.slice(arguments, 1)) : 
                    this.setProperty(prop, value);    
        }
        return this;
    }    
});



window.addEvent('domready', function(){
    

  $$('li').set('html', function(i){
      return 'do stuff here!' + i;
  });

});