Skip to content

Commit

Permalink
Fix x-ignore regression
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoTod committed Nov 29, 2024
1 parent fff5c3a commit a8350fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/alpinejs/src/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ export function initTree(el, walker = walk, intercept = () => {}) {
// If the element has a marker, it's already been initialized...
if (el._x_marker) return

// Add a marker to the element so we can tell if it's been initialized...
// This is important so that we can prevent double-initialization of
// elements that are moved around on the page.
el._x_marker = markerDispenser++

intercept(el, skip)

initInterceptors.forEach(i => i(el, skip))

directives(el, el.attributes).forEach(handle => handle())

// Add a marker to the element so we can tell if it's been initialized...
// This is important so that we can prevent double-initialization of
// elements that are moved around on the page.
if (!el._x_ignore) el._x_marker = markerDispenser++

el._x_ignore && skip()
})
})
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/integration/directives/x-ignore.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test('x-ignore.self',
}
)

test('can lazyload component',
test('can lazyload a component',
html`
<div x-data="{ lazyLoad() {$el.querySelector('#lazy').removeAttribute('x-ignore'); Alpine.nextTick(() => Alpine.initTree($el.querySelector('#lazy')))} }">
<button @click="lazyLoad">Load</button>
Expand Down

0 comments on commit a8350fc

Please sign in to comment.