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

fix: Update LanguageSelector.astro as value must be omitted for boolean attributes in html tags #186

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from

Conversation

guinetn
Copy link

@guinetn guinetn commented Jan 23, 2024

<select class="language-selector"…>  
  πŸ‘Ž <option value="/" selected='true'> English </option>       πŸ‘ˆ Change from this  
  πŸ‘ <option value="/" selected> English </option>              πŸ‘ˆ to this  

According HTML5 spec on boolean attributes
If the attribute is present, its value must either be the empty string or a value that is a case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.

Describe your changes

The code create a single selected attribute instead of a selected='true' as required by the html5 spec.
An empty attribute object is first created.
It is populated with the selected attribute if needed, using js spread syntax.
Finally the attribute object is injected in the option tag.

Fixes

Warnings with html syntax checkers.

Checklist

  • [x ] I have performed a self-review of my code
  • I have added thorough tests
  • I have updated the docs

…ibutes in html tags

<select>
  πŸ‘Ž<option value="/" selected='true'> English </option>       πŸ‘ˆ Change from this
  πŸ‘<option value="/" selected> English </option>              πŸ‘ˆ to this

According HTML5 spec on boolean attributes
- https://www.w3.org/TR/2008/WD-html5-20080610/semantics.html#boolean
If the attribute is present, its value must either be the empty string or a value that is a case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.
@guinetn guinetn changed the title Update LanguageSelector.astro: value must be omitted for boolean attributes in html tags Fix: Update LanguageSelector.astro as value must be omitted for boolean attributes in html tags Jan 23, 2024
@guinetn guinetn changed the title Fix: Update LanguageSelector.astro as value must be omitted for boolean attributes in html tags fix: Update LanguageSelector.astro as value must be omitted for boolean attributes in html tags Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant