Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
replaceChildren
in StreamActions.update
While processing `<turbo-stream action="update">` elements, Turbo combines two steps: 1. sets [`innerHTML = ""`][innerHTML] 2. call [`append(this.templateContent)`][append] Modern `Element` implementations provide a [replaceChildren][] method that effectively combines these two steps into a single, atomic operation. The `Element.replaceChildren()` method [isn't supported by Internet Explorer][replaceChildren compatibility], but the `Element.append()` method that it replaces [has the same incompatibility issues][append compatibility]. [innerHTML]: https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML [append]: https://developer.mozilla.org/en-US/docs/Web/API/Element/append [append compatibility]: https://developer.mozilla.org/en-US/docs/Web/API/Element/append#browser_compatibility [replaceChildren]: https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren [replaceChildren compatibility]: https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren#browser_compatibility
- Loading branch information