Permalink
Browse files

Fixed #71: indexOf not supported in IE7 (thanks @jaekwon).

  • Loading branch information...
1 parent 09e1a17 commit 33e521bcaaefe056522b1b13526c64689f7ab014 @mauricemach committed Sep 7, 2011
Showing with 11 additions and 7 deletions.
  1. +4 −0 CHANGELOG.md
  2. +3 −3 docs/coffeekup.html
  3. +1 −1 package.json
  4. +3 −3 src/coffeekup.coffee
View
@@ -1,3 +1,7 @@
+**v0.3.0edge** (unreleased):
+
+ - Fixed #71: indexOf not supported in IE7 (thanks @jaekwon).
+
**v0.3.0** (2011-09-04):
- Fixed #64 (`hardcode` option masked in express adapter). [smathy]
View
@@ -14,7 +14,7 @@
<span class="nv">coffeekup = </span><span class="nx">exports</span>
<span class="nv">coffee = </span><span class="nx">require</span> <span class="s1">&#39;coffee-script&#39;</span>
-<span class="nv">coffeekup.version = </span><span class="s1">&#39;0.3.0&#39;</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>Values available to the <code>doctype</code> function inside a template.
+<span class="nv">coffeekup.version = </span><span class="s1">&#39;unreleased&#39;</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>Values available to the <code>doctype</code> function inside a template.
Ex.: <code>doctype 'strict'</code></p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">coffeekup.doctypes =</span>
<span class="s1">&#39;default&#39;</span><span class="o">:</span> <span class="s1">&#39;&lt;!DOCTYPE html&gt;&#39;</span>
<span class="s1">&#39;5&#39;</span><span class="o">:</span> <span class="s1">&#39;&lt;!DOCTYPE html&gt;&#39;</span>
@@ -61,7 +61,7 @@
<span class="nv">result = </span><span class="p">[]</span>
<span class="k">for</span> <span class="nx">a</span> <span class="k">in</span> <span class="nx">args</span>
<span class="k">for</span> <span class="nx">element</span> <span class="k">in</span> <span class="nx">elements</span><span class="p">[</span><span class="nx">a</span><span class="p">].</span><span class="nx">split</span> <span class="s1">&#39; &#39;</span>
- <span class="nx">result</span><span class="p">.</span><span class="nx">push</span> <span class="nx">element</span> <span class="nx">unless</span> <span class="nx">result</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">element</span><span class="p">)</span> <span class="o">&gt;</span> <span class="o">-</span><span class="mi">1</span>
+ <span class="nx">result</span><span class="p">.</span><span class="nx">push</span> <span class="nx">element</span> <span class="nx">unless</span> <span class="nx">element</span> <span class="k">in</span> <span class="nx">result</span>
<span class="nx">result</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Public/customizable list of possible elements.
For each name in this list that is also present in the input template code,
a function with the same name will be added to the compiled template.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">coffeekup.tags = </span><span class="nx">merge_elements</span> <span class="s1">&#39;regular&#39;</span><span class="p">,</span> <span class="s1">&#39;obsolete&#39;</span><span class="p">,</span> <span class="s1">&#39;void&#39;</span><span class="p">,</span> <span class="s1">&#39;obsolete_void&#39;</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>Public/customizable list of elements that should be rendered self-closed.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">coffeekup.self_closing = </span><span class="nx">merge_elements</span> <span class="s1">&#39;void&#39;</span><span class="p">,</span> <span class="s1">&#39;obsolete_void&#39;</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>This is the basic material from which compiled templates will be formed.
@@ -87,7 +87,7 @@
<span class="nv">classes = </span><span class="p">[]</span>
<span class="k">for</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">str</span><span class="p">.</span><span class="nx">split</span> <span class="s1">&#39;.&#39;</span>
- <span class="k">if</span> <span class="nx">i</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">&#39;#&#39;</span><span class="p">)</span> <span class="o">is</span> <span class="mi">0</span>
+ <span class="k">if</span> <span class="s1">&#39;#&#39;</span> <span class="k">in</span> <span class="nx">i</span>
<span class="nv">id = </span><span class="nx">i</span><span class="p">.</span><span class="nx">replace</span> <span class="s1">&#39;#&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span>
<span class="k">else</span>
<span class="nx">classes</span><span class="p">.</span><span class="nx">push</span> <span class="nx">i</span> <span class="nx">unless</span> <span class="nx">i</span> <span class="o">is</span> <span class="s1">&#39;&#39;</span>
View
@@ -1,7 +1,7 @@
{
"name": "coffeekup",
"description": "Markup as CoffeeScript.",
- "version": "0.3.0",
+ "version": "0.3.0edge",
"author": "Maurice Machado <maurice@bitbending.com>",
"homepage": "http://coffeekup.org",
"repository": {"type": "git", "url": "git://github.com/mauricemach/coffeekup.git"},
@@ -16,7 +16,7 @@ else
coffeekup = exports
coffee = require 'coffee-script'
-coffeekup.version = '0.3.0'
+coffeekup.version = '0.3.0edge'
# Values available to the `doctype` function inside a template.
# Ex.: `doctype 'strict'`
@@ -80,7 +80,7 @@ merge_elements = (args...) ->
result = []
for a in args
for element in elements[a].split ' '
- result.push element unless result.indexOf(element) > -1
+ result.push element unless element in result
result
# Public/customizable list of possible elements.
@@ -126,7 +126,7 @@ skeleton = (data = {}) ->
classes = []
for i in str.split '.'
- if i.indexOf('#') is 0
+ if '#' in i
id = i.replace '#', ''
else
classes.push i unless i is ''

0 comments on commit 33e521b

Please sign in to comment.