Browse Source

minor updates

Evan You 12 years ago
parent
commit
0e91e50df3
4 changed files with 7 additions and 4 deletions
  1. 1 1
      README.md
  2. 1 0
      README_Chinese.md
  3. 2 1
      examples/todos/index.html
  4. 3 2
      src/seed.js

+ 1 - 1
README.md

@@ -1,4 +1,4 @@
-# Seed
+# Seed (WIP)
 ## a mini MVVM framework
 
 - 5kb gzipped!

+ 1 - 0
README_Chinese.md

@@ -4,6 +4,7 @@
 - gzip后5kb大小
 - 基于DOM的动态模版,精确到TextNode的DOM操作
 - 管道过滤函数 (filter piping)
+- 自定义绑定函数 (directive) 和过滤函数 (filter)
 - Model就是原生JS对象,不需要繁琐的get()或set()。操作对象自动更新DOM
 - 自动抓取需要计算的属性 (computed properties) 的依赖
 - 在数组重复的元素上添加listener的时候自动代理事件 (event delegation)

+ 2 - 1
examples/todos/index.html

@@ -21,6 +21,7 @@
             </header>
             
             <section id="main" sd-show="total">
+                <!-- toggle all checkbox-->
                 <input 
                     id="toggle-all"
                     type="checkbox"
@@ -60,7 +61,7 @@
             <!-- footer controls -->
             <footer id="footer" sd-show="total">
                 <span id="todo-count">
-                    <strong sd-text="remaining"></strong> {{itemLabel}} left
+                    <strong>{{remaining}}</strong> {{itemLabel}} left
                 </span>
                 <ul id="filters">
                     <li><a href="#/all" data-filter="all" sd-on="click:setFilter">All</a></li>

+ 3 - 2
src/seed.js

@@ -156,11 +156,12 @@ Seed.prototype._compileNode = function (node, root) {
 Seed.prototype._compileTextNode = function (node) {
     var tokens = TextParser.parse(node)
     if (!tokens) return
-    var seed = this
+    var seed = this,
+        dirname = config.prefix + '-text'
     tokens.forEach(function (token) {
         var el = document.createTextNode()
         if (token.key) {
-            var directive = Directive.parse(config.prefix + '-text', token.key)
+            var directive = Directive.parse(dirname, token.key)
             if (directive) {
                 directive.el = el
                 seed._bind(directive)