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

[BUG] FT attributes with value 0 (int) are ignored. #567

Open
3 tasks done
pitvfx opened this issue Nov 6, 2024 · 0 comments
Open
3 tasks done

[BUG] FT attributes with value 0 (int) are ignored. #567

pitvfx opened this issue Nov 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pitvfx
Copy link

pitvfx commented Nov 6, 2024

Important Notice
We do not provide support through GitHub issues. For community-based help, please use either:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant