Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

TagBuilder can't build valueless attributes #4078

Closed
geertdoornbos opened this issue Feb 11, 2016 · 1 comment
Closed

TagBuilder can't build valueless attributes #4078

geertdoornbos opened this issue Feb 11, 2016 · 1 comment

Comments

@geertdoornbos
Copy link

The Tagbuilder can't build a tag that had attributes with no value, like:

<script src="..." async></script>

It is currently possible to build alternatives:
<script src="..." async=""></script>
or
<script src="..." async="async"></script>

All three ways should be possible, where the first is the most clean way.

@dougbu
Copy link
Member

dougbu commented Feb 11, 2016

Suspect you'd be better served using TagHelperOutput. On one hand TagBuilder is intended for HTML generation from code and we long-ago chose to emit only XHTML syntax. On the other, TagHelperOutput is intended to maintain the original syntax (from a .cshtml file) when filtering that HTML through a tag helper.

In any case TagBuilder does not support minimized attributes, sorts the generated attributes alphabetically by name, and more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants