<!DOCTYPE html>  <html> <head>   <title>adapter.prototype.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="adapter.ender.html">                 adapter.ender.coffee               </a>                                           <a class="source" href="adapter.jquery.html">                 adapter.jquery.coffee               </a>                                           <a class="source" href="adapter.native.html">                 adapter.native.coffee               </a>                                           <a class="source" href="adapter.prototype.html">                 adapter.prototype.coffee               </a>                                           <a class="source" href="opentip.html">                 opentip.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               adapter.prototype.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="nv">$ = </span><span class="nx">ender</span>


<span class="k">class</span> <span class="nx">Adapter</span>

  <span class="nv">name: </span><span class="s">&quot;prototype&quot;</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>Simply using $.domReady</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">domReady: </span><span class="nf">(callback) -&gt;</span> <span class="nx">Event</span><span class="p">.</span><span class="nx">observe</span> <span class="nb">window</span><span class="p">,</span> <span class="s">&quot;dom:loaded&quot;</span><span class="p">,</span> <span class="nx">callback</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Using bonzo to create html</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">create: </span><span class="nf">(html) -&gt;</span> <span class="nx">$</span> <span class="nx">html</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>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 {})</p>             </td>             <td class="code">               <div class="highlight"><pre>    </pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p># 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 (class<em>name) ->
      element.addClassName class</em>name</p>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>if children
    if Object.isArray(children)
      children.each (child) ->
        element.insert bottom: child</p>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <pre><code>else
  element.insert bottom: children
</code></pre>

<p>element</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">adapter = </span><span class="k">new</span> <span class="nx">Adapter</span>

<span class="nx">Opentip</span><span class="p">.</span><span class="nx">addAdapter</span> <span class="nx">adapter</span>

</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html>