Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

change to data-funcd

  • Loading branch information...
commit 33d704aa0c22def1ed9bc9e05430b449c353879e 1 parent f9026c1
@mgutz authored
Showing with 16 additions and 12 deletions.
  1. +5 −5 README.md
  2. +6 −4 lib/funcd.js
  3. +5 −3 src/lib/funcd.coffee
View
10 README.md
@@ -75,7 +75,7 @@ Render from files
t.div name + " " + city
# <div>foo San Diego</div>
- Funcd.render "#{__dirname}/test", "foo", "San Diego"
+ Funcd.render "#{__dirname}/test", "foo", "San Diego"
jQuery Asynchronous updates
@@ -87,16 +87,16 @@ jQuery Asynchronous updates
t.coffeescript """
update = ($el) ->
- setTimeout (->
+ setTimeout (->
$el.funcd (t) -> t.div "bar baby!"
), 2000
template = (t) ->
t.div style:"background-color:#999; color:#000", "inserted via template"
- t.div "data-funcd-async":update, "this will change in 2 seconds"
+ t.div "data-funcd":update, "this will change in 2 seconds"
- $ ->
- $('#content').funcd template
+ $ ->
+ $('#content').funcd template
"""
View
10 lib/funcd.js
@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.2.1-pre
(function() {
- var Funcd, attributeList, defaultAttributes, doctypes, elements, escapeHtml, htmlChars, idSequence, mergeElements, mixinShortTag, mixinTag, nextId, rawContentElements, replaceToken, requireEx, tokensToReplace, _,
+ var DATA_FUNCD_ASYNC, Funcd, attributeList, defaultAttributes, doctypes, elements, escapeHtml, htmlChars, idSequence, mergeElements, mixinShortTag, mixinTag, nextId, rawContentElements, replaceToken, requireEx, tokensToReplace, _,
__slice = [].slice,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
@@ -10,6 +10,8 @@
_ = window._;
}
+ DATA_FUNCD_ASYNC = 'data-funcd';
+
requireEx = function(mod, nocache) {
if (nocache == null) nocache = false;
if (nocache) delete require.cache[require.resolve(mod)];
@@ -321,9 +323,9 @@
innerText = arg.__raw;
} else {
if (parseAttributes) {
- if (arg["data-funcd-async"]) {
- asyncfn = arg["data-funcd-async"];
- delete arg["data-funcd-async"];
+ if (arg[DATA_FUNCD_ASYNC]) {
+ asyncfn = arg[DATA_FUNCD_ASYNC];
+ delete arg[DATA_FUNCD_ASYNC];
if (!arg.id) arg.id = nextId();
this.asyncCallbacks.push({
lambda: asyncfn,
View
8 src/lib/funcd.coffee
@@ -10,6 +10,8 @@ if global?
else
_ = window._
+DATA_FUNCD_ASYNC = 'data-funcd'
+
requireEx = (mod, nocache=false) ->
# node.js caches includes
if nocache
@@ -277,9 +279,9 @@ class Funcd
innerText = arg.__raw
else
if parseAttributes
- if arg["data-funcd-async"]
- asyncfn = arg["data-funcd-async"]
- delete arg["data-funcd-async"]
+ if arg[DATA_FUNCD_ASYNC]
+ asyncfn = arg[DATA_FUNCD_ASYNC]
+ delete arg[DATA_FUNCD_ASYNC]
unless arg.id
arg.id = nextId()
@asyncCallbacks.push lambda:asyncfn, id:arg.id
Please sign in to comment.
Something went wrong with that request. Please try again.