Просмотр исходного кода

resolve rebase conflicts for updatePrefix()

Evan You 12 лет назад
Родитель
Сommit
cfb1e664ac
3 измененных файлов с 17 добавлено и 4 удалено
  1. 14 3
      src/compiler.js
  2. 2 1
      src/transition.js
  3. 1 0
      test/unit/specs/viewmodel.js

+ 14 - 3
src/compiler.js

@@ -229,7 +229,9 @@ CompilerProto.compile = function (node, root) {
                 compiler.childCompilers.push(child.$compiler)
                 compiler.childCompilers.push(child.$compiler)
             }
             }
         } else {
         } else {
-            if (partialId) { // replace innerHTML with partial
+
+            // replace innerHTML with partial
+            if (partialId) {
                 node.removeAttribute(config.partialAttr)
                 node.removeAttribute(config.partialAttr)
                 var partial = compiler.getOption('partials', partialId)
                 var partial = compiler.getOption('partials', partialId)
                 if (partial) {
                 if (partial) {
@@ -237,12 +239,21 @@ CompilerProto.compile = function (node, root) {
                     node.appendChild(partial.cloneNode(true))
                     node.appendChild(partial.cloneNode(true))
                 }
                 }
             }
             }
+
+            // Javascript transition
             if (transId) {
             if (transId) {
+                // TODO implement this
+                node.removeAttribute(config.transAttr)
+            }
+
+            // CSS class transition
+            if (transClass) {
                 // attach the transition id to node
                 // attach the transition id to node
                 // its only text so should be fine...
                 // its only text so should be fine...
-                node.sd_trans_class = transId
-                node.removeAttribute(transitionAttr)
+                node.sd_trans_class = transClass
+                node.removeAttribute(config.transClassAttr)
             }
             }
+
             // finally, only normal directives left!
             // finally, only normal directives left!
             compiler.compileNode(node)
             compiler.compileNode(node)
         }
         }

+ 2 - 1
src/transition.js

@@ -18,7 +18,7 @@ module.exports = function (el, stage, changeState, init) {
     // in sd-repeat, the sd-transition directive
     // in sd-repeat, the sd-transition directive
     // might not have been processed yet
     // might not have been processed yet
     if (!className) {
     if (!className) {
-        className = el.getAttribute(config.prefix + '-transition-class')
+        className = el.getAttribute(config.transClassAttr)
     }
     }
 
 
     // TODO: optional duration which
     // TODO: optional duration which
@@ -45,6 +45,7 @@ module.exports = function (el, stage, changeState, init) {
         // append
         // append
         changeState()
         changeState()
         // force a layout so transition can be triggered
         // force a layout so transition can be triggered
+        /* jshint unused: false */
         var forceLayout = el.clientHeight
         var forceLayout = el.clientHeight
         // trigger transition
         // trigger transition
         classList.remove(className)
         classList.remove(className)

+ 1 - 0
test/unit/specs/viewmodel.js

@@ -305,6 +305,7 @@ describe('UNIT: ViewModel', function () {
                 }
                 }
             },
             },
             el: {
             el: {
+                getAttribute: function () {},
                 parentNode: {
                 parentNode: {
                     removeChild: function () {
                     removeChild: function () {
                         elRemoved = true
                         elRemoved = true