WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@willrowe
Copy link
Contributor

@willrowe willrowe commented Mar 17, 2025

This adds an ignore-nullish modifier to x-html and x-text. If the value is set to null or undefined, the currently set HTML/text will remain unchanged.

The main use case for this is to have the initial HTML/text set in the markup on page load. See the updates to the documentation for examples.

@ekwoka
Copy link
Contributor

ekwoka commented Mar 18, 2025

I like the modifier approach.

I think I'd be more partial to preserve-nullish as opposed to ignore but that's just my opinion.

@willrowe
Copy link
Contributor Author

willrowe commented Mar 18, 2025

@ekwoka

I think I'd be more partial to preserve-nullish as opposed to ignore but that's just my opinion.

preserve-nullish implies that you are preserving a nullish value, which I would find confusing.

@ekwoka
Copy link
Contributor

ekwoka commented Mar 18, 2025

Yeah....but preserve-on-nullish is too long 😭

@Tim-Wils
Copy link

What is the value becomes null again after being set to a value? Shouldn't the value become the original innerHTML again with this modifier?

@willrowe
Copy link
Contributor Author

@Tim-Wils no, as the name infers, it ignores any nullish values and does not change the HTML/text. It will be most useful on initial state.

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