浏览代码

Don't init trees within ignore elements (x-ignore)

Caleb Porzio 6 月之前
父节点
当前提交
463f2770ed
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      packages/alpinejs/src/lifecycle.js

+ 3 - 0
packages/alpinejs/src/lifecycle.js

@@ -83,6 +83,9 @@ let initInterceptors = []
 export function interceptInit(callback) { initInterceptors.push(callback) }
 export function interceptInit(callback) { initInterceptors.push(callback) }
 
 
 export function initTree(el, walker = walk, intercept = () => {}) {
 export function initTree(el, walker = walk, intercept = () => {}) {
+    // Don't init a tree within a parent that is being ignored.
+    if (findClosest(el, i => i._x_ignore)) return
+
     deferHandlingDirectives(() => {
     deferHandlingDirectives(() => {
         walker(el, (el, skip) => {
         walker(el, (el, skip) => {
             intercept(el, skip)
             intercept(el, skip)