Jump To …

adapter.prototype.coffee

$ = ender


class Adapter

  name: "prototype"

Simply using $.domReady

  domReady: (callback) -> Event.observe window, "dom:loaded", callback

Using bonzo to create html

  create: (html) -> $ html

Mimics scriptaculous Builder.node behaviour element: (tagName, attributes, children) -> if Object.isArray(attributes) or Object.isString(attributes) or Object.isElement(attributes) children = attributes attributes = null element = new Element(tagName, attributes or {})

    

# This is a prototype 1.6 bug, that doesn't apply the className to IE8 elements. # Thanks to Alexander Shakhnovsky for finding the bug, and pinpointing the problem. if attributes and attributes["className"] attributes["className"].split(" ").each (classname) -> element.addClassName classname

if children if Object.isArray(children) children.each (child) -> element.insert bottom: child

else
  element.insert bottom: children

element

adapter = new Adapter

Opentip.addAdapter adapter