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

Fixed Internal Attributes #111 #112

Merged
merged 8 commits into from
Apr 30, 2020
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/bunit.web/Rendering/Internal/Htmlizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ internal class Htmlizer
"area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"
};

private const string BLAZOR_INTERNAL_ATTR_PREFIX = "__internal_";

public const string BLAZOR_ATTR_PREFIX = "blazor:";
public const string ELEMENT_REFERENCE_ATTR_NAME = BLAZOR_ATTR_PREFIX + "elementreference";

Expand Down Expand Up @@ -220,6 +222,14 @@ private static int RenderAttributes(

switch (frame.AttributeValue)
{
case bool flag when flag && frame.AttributeName.StartsWith(BLAZOR_INTERNAL_ATTR_PREFIX, StringComparison.Ordinal):
// NOTE: This was added to make it more obvious
// that this is a generated/special blazor attribute
// for internal usage
result.Add(" ");
result.Add(BLAZOR_ATTR_PREFIX);
result.Add(frame.AttributeName);
break;
case bool flag when flag:
result.Add(" ");
result.Add(frame.AttributeName);
Expand Down