AnswerDotAI / fasthtml

The fastest way to create an HTML app
https://fastht.ml/
Apache License 2.0
5.27k stars 219 forks source link

[BUG] Incorrect property generated for Label("name", for_="test") #326

Closed Ptark closed 1 month ago

Ptark commented 1 month ago

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:

Confirmation Please confirm the following:

Additional context Add any other context about the problem here.

Screenshots If applicable, add screenshots to help explain your problem.

Ptark commented 1 month ago

Apparently, the "for_" property in the examples repo doesn't work, but "_for" does.