-
Notifications
You must be signed in to change notification settings - Fork 283
Description
Important Notice
We do not provide support through GitHub issues. For community-based help, please use either:
- GitHub Discussions tab
- Our Discord channel
If you're reporting a bug, please continue with this template.
Describe the bug
Attributes fo FT with a numeric value of 0 are ignored. Changing to str "0" works, though.
Minimal Reproducible Example
Provide a minimal code snippet that reproduces the issue. This is crucial for us to understand and fix the bug quickly.
from fasthtml.core import to_xml
from fasthtml.components import Input
# ignored
num_input = Input(type="number", min=0, max=100)
txt_input = Input(type="text", minlength=0, maxlength=100)
print("min ignored:\n", to_xml(num_input),
"minlength ignored:\n", to_xml(txt_input))
# accepted
num_input = Input(type="number", min="0", max=100)
txt_input = Input(type="text", minlength="0", maxlength=100)
print("min accepted:\n", to_xml(num_input),
"minlength accepted:\n", to_xml(txt_input))Output:
min ignored:
<input type="number" max="100">
minlength ignored:
<input type="text" maxlength="100">
min accepted:
<input type="number" min="0" max="100">
minlength accepted:
<input type="text" minlength="0" maxlength="100">
Expected behavior
That numeric values of 0 are accepted for FT attributes.
Environment Information
Please provide the following version information:
- fastlite version: 0.0.13
- fastcore version: 1.7.19
- fasthtml version: 0.8.0
Confirmation
Please confirm the following:
- I have read the FAQ (https://docs.fastht.ml/explains/faq.html)
- I have provided a minimal reproducible example
- I have included the versions of fastlite, fastcore, and fasthtml
- [x ] I understand that this is a volunteer open source project with no commercial support.
Additional context
Add any other context about the problem here.
Screenshots
If applicable, add screenshots to help explain your problem.