Skip to content

Allow to patch custom elements #438

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

Merged
merged 2 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog
[unreleased]
- [BREAKING] Custom elements are now patched in-place (#364). Use `el_key` to force reinitialize an element.
- Added `el_key` method for adding keys to `El`s (#354).
- Enabled all additional markdown [extensions](https://docs.rs/pulldown-cmark/latest/pulldown_cmark/struct.Options.html).
- Removed `'static` bound from `El` and `Node`.
Expand Down
7 changes: 1 addition & 6 deletions src/virtual_dom/patch/patch_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,7 @@ where

/// Checks whether the old element can be updated with a new one.
pub(crate) fn el_can_be_patched<Ms>(el_old: &El<Ms>, el_new: &El<Ms>) -> bool {
// Custom elements can't be patched, because we need to reinit them (Issue #325).
// @TODO remove this check when #364 will be done.
el_old.namespace == el_new.namespace
&& el_old.tag == el_new.tag
&& el_old.key == el_new.key
&& !el_new.is_custom()
el_old.namespace == el_new.namespace && el_old.tag == el_new.tag && el_old.key == el_new.key
}

/// Takes children from source iterators (new and old) and puts them in the
Expand Down