JSFiddle - React, Tailwind, and code Playground
JavaScript
var foo = new Class({
message: "hi",
toElement: function() {
return this.element = new Element("a", {
href: "http://www.google.com",
text: "google",
events: {
"click": this.bar.bind(this),
"mouseenter": this.bar
}
});
},
bar: function(event) {
event.stop();
// hi when bound, undefined otherwise.
console.log(this.message || "undefined");
}
});
document.id(new foo()).inject(document.body);