Skip to content

include-fragment-replaced triggered twice #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bjhijmans opened this issue Mar 15, 2022 · 0 comments · Fixed by #79
Closed

include-fragment-replaced triggered twice #75

bjhijmans opened this issue Mar 15, 2022 · 0 comments · Fixed by #79

Comments

@bjhijmans
Copy link

Under some conditions, the 'include-fragment-replaced' and 'include-fragment-replace' events are triggered twice.

Fiddle: https://jsfiddle.net/36koL2mb/1/

Fiddle code:

<script type="module" src="https://unpkg.com/@github/include-fragment-element@latest?module"></script>
<include-fragment id="suggest-as-template" src="https://github.github.io/include-fragment-element/examples/pull.html">
  <p>'Loading...</p>
</include-fragment>
$('include-fragment').on('include-fragment-replaced', function () {
	console.log('hello');
})

In this example, "hello" is printed to the console twice, and it should only be triggered once, because the fragment is only replaced once. I do not know why this is happening. In other places it does seem to only trigger once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant