Skip to content
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

Add component docs #181

Merged
merged 3 commits into from
Nov 17, 2023
Merged

Add component docs #181

merged 3 commits into from
Nov 17, 2023

Conversation

macdonst
Copy link
Contributor

Adds component docs to enhance.dev.

I left docs/conventions/browser unchanged but I can update that file as well if it makes sense.

Signed-off-by: macdonst <[email protected]>

</doc-code>

Once added the `MorphdomMixin` will handle updating the DOM whenever an `observedAttributes` is modified. The `<attribute name>Changed` methods are no longer necessary. Instead on an attribute change the `render` method will be re-run and the output will be compared against the current DOM. Only the modified DOM nodes will be updated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will work on a Morphdom doc that should be linked to here in a callout.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could optionally make a mention about how Morphdom does a String based diff on an the actual HTML element and not a virtual DOM diff so every element you want diffed needs to have a string change or unique id.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think I should put that in the callout below or part of the paragraph?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't hurt to put it something in the paragraph as well

Copy link
Contributor

@kristoferjoseph kristoferjoseph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Left a few minor comments.


### Lists

When working with lists of data in the DOM it is highly advisable to add a unique attribute to the list item like an `id` or `key`. This will assist `morphdom` in determining what items have changed in the list.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment. It may help to call out string based diff vs vdom diffing in this callout.

scripts/dictionary.txt Outdated Show resolved Hide resolved
@macdonst
Copy link
Contributor Author

@kristoferjoseph new changes pushed.

@kristoferjoseph kristoferjoseph merged commit 3afae49 into main Nov 17, 2023
@kristoferjoseph kristoferjoseph deleted the components branch November 17, 2023 19:14
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 this pull request may close these issues.

3 participants