forked from enyo/opentip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadapter.prototype.html
26 lines (20 loc) · 5.57 KB
/
adapter.prototype.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!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 … <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">¶</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">"prototype"</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">¶</a> </div> <p>Simply using $.domReady</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">domReady: </span><span class="nf">(callback) -></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">"dom:loaded"</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">¶</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) -></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">¶</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">¶</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">¶</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">¶</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>