[BUG] Incorrect property generated for Label("name", for_="test")
Describe the bug
A clear and concise description of what the bug is.
Label("name", for_="test")
generates:
<label for-="test">name</label>
It should generate:
<label for="test">name</label>
Minimal Reproducible Example Provide a minimal code snippet that reproduces the issue. This is crucial for us to understand and fix the bug quickly.
# Your code here
from fasthtml.common import FastHTML, serve, Label
app = FastHTML()
@app.route("/", methods=["GET"])
def home():
return Label("test_label", for_="test")
serve()
Expected behavior A clear and concise description of what you expected to happen. The generated property should be "for", not "for-".
Environment Information Please provide the following version information:
- fastlite version: 0.0.9
- fastcore version: 1.7.1
- fasthtml version: 0.4.3
Confirmation Please confirm the following:
- [ x] I have read the FAQ (https://docs.fastht.ml/explains/faq.html)
- [ x] I have provided a minimal reproducible example
- [ x] 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.
Apparently, the "for_" property in the examples repo doesn't work, but "_for" does.
Thanks _for works for me.
Is there a reason why it is not just for?
I think for_ should be removed and _for be rename to for.
Ok i see now, it is because of the python keywords for.
Something similar with type in the Input / <input> tag.
But in the case of 'type, not only does the parameter _typeproduce valid HTML, also there is atypeparameter that works. The difference is thattype` is not a keyword but a built-in function.
But in both cases for_ and type_ invalid HTML code is produced, so i would see this as a bug.