Browse Source

allow empty template (close #3212)

Evan You 10 years ago
parent
commit
163994c6eb
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/compiler/transclude.js

+ 3 - 0
src/compiler/transclude.js

@@ -74,6 +74,9 @@ function transcludeTemplate (el, options) {
   var frag = parseTemplate(template, true)
   var frag = parseTemplate(template, true)
   if (frag) {
   if (frag) {
     var replacer = frag.firstChild
     var replacer = frag.firstChild
+    if (!replacer) {
+      return frag
+    }
     var tag = replacer.tagName && replacer.tagName.toLowerCase()
     var tag = replacer.tagName && replacer.tagName.toLowerCase()
     if (options.replace) {
     if (options.replace) {
       /* istanbul ignore if */
       /* istanbul ignore if */