FriendToNetWebDevelopers.HtmlAttributeDictionary
1.0.1
See the version list below for details.
dotnet add package FriendToNetWebDevelopers.HtmlAttributeDictionary --version 1.0.1
NuGet\Install-Package FriendToNetWebDevelopers.HtmlAttributeDictionary -Version 1.0.1
<PackageReference Include="FriendToNetWebDevelopers.HtmlAttributeDictionary" Version="1.0.1" />
paket add FriendToNetWebDevelopers.HtmlAttributeDictionary --version 1.0.1
#r "nuget: FriendToNetWebDevelopers.HtmlAttributeDictionary, 1.0.1"
// Install FriendToNetWebDevelopers.HtmlAttributeDictionary as a Cake Addin #addin nuget:?package=FriendToNetWebDevelopers.HtmlAttributeDictionary&version=1.0.1 // Install FriendToNetWebDevelopers.HtmlAttributeDictionary as a Cake Tool #tool nuget:?package=FriendToNetWebDevelopers.HtmlAttributeDictionary&version=1.0.1
HTML Attribute Dictionary
Summary
A dictionary which extends Dictionary<string,string> and provides html attribute and value safety features.
Installation
NuGet\Install-Package FriendToNetWebDevelopers.HtmlAttributeDictionary -Version 1.0.1
Usage
This is the simplest use case I could come up with.
@{ // Please note the multiple classes being brought in
// Along with your id ↓ ↓
// ↓ ↓ ↓
var dictionary = HtmlAttributeDictionaryFactory.WithId("foo", "some-hero bar");
if(needsScrim)
{
dictionary.AddClassToClassAttribute("hero-scrim");
}
}
<section>
<div @Html.Raw(dictionary)>
</div>
</section>
This keeps things simple and safe. It even allows for data to come in from an unsafe source and be safe to display.
It even prevents invalid attributes from being added.
License Information
HTML Attribute Dictionary by Christopher Goehrs through Friend to .NET Web Developers is licensed under CC BY 4.0
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.