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

Change Razor attribute behavior to not special case boolean values in middle of complex attribute values. #2769

@NTaylorMullen

Description

@NTaylorMullen

Today if a user writes:

@{
    var isActive = true;
}
<input type="button" onclick="doSomething(@isActive);" />

It generates <input type="button" onclick="doSomething(onclick);" />. If isActive is false it removes the content entirely. This feature had good intentions in MVC5 but should be scoped to non-complex attribute values; aka values that only have a single value.

Intended output:

<input checked="@true" />                 => <input checked="checked" />
<input checked="@false" />                => <input />
<input checked="   @true         " />     => <input checked="   True         " />
<input checked="   @false        " />     => <input checked="   False        " />
<input checked="value: @true" />          => <input checked="value: True" />
<input checked="value: @false" />         => <input checked="value: False" />

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions