8000 Add support to naked attributes · Issue #768 · mint-lang/mint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support to naked attributes #768

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

Closed
memburg opened this issue Apr 21, 2025 · 4 comments
Closed

Add support to naked attributes #768

memburg opened this issue Apr 21, 2025 · 4 comments
Labels
wontfix This will not be worked on

Comments

@memburg
Copy link
memburg commented Apr 21, 2025

Support to naked attributes would prevents issues like the following:

I was expecting the equal sign of an HTML attribute but I found "></textarea>"
instead:

When I tried to explicitly set the value I got the following:

The type of the value for the property "readonly" of element "textarea" does not
match its type.

I was expecting:

  Bool

Instead it is:

  String

This would be a nice feature to avoid the usage of JavaScript to set the property.

@Sija
Copy link
Member
Sija commented Apr 21, 2025

Could you post the failing code?

@memburg
Copy link
Author
memburg commented Apr 22, 2025

Hi, sure.

This is the piece of code causing the issue:

component TestComp {
  fun render {
    <div class="fi">
      <textarea id="mv" readonly></textarea>
    </div>
  }
}

or

component TestComp {
  fun render {
    <div class="fi">
      <textarea id="mv" readonly="true"></textarea>
    </div>
  }
}

@gdotdesign
Copy link
Member

Hi 👋

In Mint, there are three HTML attributes which take a Bool instead of String: readonly, disabled, checked:

component Main {
  fun render : Html {
  	<textarea id="mv" readonly={true}></textarea>
  }
}

They set the associated property on the HTML element, so there is no need to fall back to JavaScript for this.


Not having naked attributes is intentional to avoid ambiguity in some cases and to keep the language simpler.

@memburg
Copy link
Author
memburg commented Apr 22, 2025

Cool, thanks for the clarification!

@gdotdesign gdotdesign added the wontfix This will not be worked on label Apr 22, 2025
@Sija Sija reopened this Apr 22, 2025
@Sija Sija closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Development

No branches or pull requests

3 participants
0