소스 검색

Switch to el.content.childNodes.length

Hugo 5 년 전
부모
커밋
2dad058693
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/utils.js

+ 1 - 1
src/utils.js

@@ -23,7 +23,7 @@ export function isTesting() {
 export function warnIfMalformedTemplate(el, directive) {
     if (el.tagName.toLowerCase() !== 'template') {
         console.warn(`Alpine: [${directive}] directive should only be added to <template> tags. See https://github.com/alpinejs/alpine#${directive}`)
-    } else if (el.content.childElementCount !== 1) {
+    } else if (el.content.childNodes.length !== 1) {
         console.warn(`Alpine: <template> tag with [${directive}] encountered with multiple element roots. Make sure <template> only has a single child node.`)
     }
 }