6 writes to Attributes
Microsoft.AspNetCore.Mvc.TagHelpers.Test (6)
InputTagHelperTest.cs (5)
860Attributes = 1292Attributes = 1458Attributes = 1552Attributes = 1670Attributes =
TestableHtmlGenerator.cs (1)
98Attributes =
73 references to Attributes
Microsoft.AspNetCore.Mvc.TagHelpers (4)
InputTagHelper.cs (2)
256if (tagBuilder.Attributes.TryGetValue("name", out var fullName) && 336if (!hiddenForCheckboxTag.Attributes.ContainsKey("name") &&
TagHelperOutputExtensions.cs (2)
78/// Merges the given <paramref name="tagBuilder"/>'s <see cref="TagBuilder.Attributes"/> into the 90foreach (var attribute in tagBuilder.Attributes)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (17)
InputTagHelperTest.cs (2)
875.Callback(() => viewContext.FormContext.InvariantField(tagBuilder.Attributes["name"], usesInvariantFormatting)) 879? $"<input name=\"__Invariant\" type=\"hidden\" value=\"{tagBuilder.Attributes["name"]}\" />"
TagHelperOutputExtensionsTest.cs (8)
782tagBuilder.Attributes.Add(attr.Key, attr.Value); 808tagBuilder.Attributes.Add("type", "hello"); 830tagBuilder.Attributes.Add("class", "btn"); 858tagBuilder.Attributes.Add(updateName, "btn"); 883tagBuilder.Attributes.Add("visible", "val < 3"); 906tagBuilder.Attributes.Add("class", "btn"); 907tagBuilder.Attributes.Add("class2", "btn"); 956tagBuilder.Attributes.Add("for", "hello");
ValidationMessageTagHelperTest.cs (4)
302tagBuilder.Attributes.Add("data-foo", "bar"); 303tagBuilder.Attributes.Add("data-hello", "world"); 365tagBuilder.Attributes.Add("data-foo", "bar"); 366tagBuilder.Attributes.Add("data-hello", "world");
ValidationSummaryTagHelperTest.cs (3)
398tagBuilder.Attributes.Add("anything", "something"); 399tagBuilder.Attributes.Add("data-foo", "bar"); 400tagBuilder.Attributes.Add("data-hello", "world");
Microsoft.AspNetCore.Mvc.ViewFeatures (30)
DefaultDisplayTemplates.cs (4)
35inputTag.Attributes["disabled"] = "disabled"; 36inputTag.Attributes["type"] = "checkbox"; 39inputTag.Attributes["checked"] = "checked"; 51selectTag.Attributes["disabled"] = "disabled";
DefaultHtmlGenerator.cs (6)
390tagBuilder.Attributes.Add("for", idString); 1048tagBuilder.Attributes["value"] = item.Value; 1053tagBuilder.Attributes["selected"] = "selected"; 1058tagBuilder.Attributes["disabled"] = "disabled"; 1173var suppliedTypeString = tagBuilder.Attributes["type"]; 1380tagBuilder.Attributes);
DefaultHtmlGeneratorExtensions.cs (2)
40tagBuilder.Attributes["action"] += "#" + fragment; 71tagBuilder.Attributes["action"] += "#" + fragment;
HtmlHelper.cs (5)
743if (!hiddenForCheckbox.Attributes.ContainsKey("name") && 744checkbox.Attributes.TryGetValue("name", out var name)) 1063if (tagBuilder.Attributes.Count == 0) 1068else if (tagBuilder.Attributes.Count == 1 && 1069tagBuilder.Attributes.TryGetValue("for", out var forAttribute) &&
NameAndIdProvider.cs (3)
75/// nothing if <see cref="TagBuilder.Attributes"/> already contains an "id" attribute or the 106if (!tagBuilder.Attributes.ContainsKey("id")) 114tagBuilder.Attributes["id"] = sanitizedId;
Rendering\TagBuilder.cs (10)
57Attributes.Add(tag); 127if (Attributes.TryGetValue("class", out var currentValue)) 129Attributes["class"] = currentValue + " " + value; 133Attributes["class"] = value; 201/// nothing if <see cref="Attributes"/> already contains an "id" attribute or the <paramref name="name"/> 221if (!Attributes.ContainsKey("id")) 229Attributes["id"] = sanitizedId; 239foreach (var attribute in Attributes) 281if (replaceExisting || !Attributes.ContainsKey(key)) 283Attributes[key] = value;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (22)
DefaultHtmlGeneratorTest.cs (10)
132var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "name"); 186var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "name"); 210var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); 234var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); 258var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); 280var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); 302Assert.DoesNotContain(tagBuilder.Attributes, a => a.Key == "maxlength"); 326var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); 433Assert.DoesNotContain(tagBuilder.Attributes, a => a.Key == "maxlength"); 486var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "data-valmsg-for");
Rendering\TagBuilderTest.cs (12)
31tagBuilder.Attributes.Add("Hello", "World"); 37var attribute = Assert.Single(tagBuilder.Attributes); 46tagBuilder.Attributes.Add("ClaSs", "btn"); 52var attribute = Assert.Single(tagBuilder.Attributes); 61tagBuilder.Attributes.Add("ID", "something"); 67var attribute = Assert.Single(tagBuilder.Attributes); 78tagBuilder.Attributes.Add("ID", string.Empty); 153tagBuilder.Attributes.Add(attributeKey, attributeValue); 320Assert.NotSame(originalTagBuilder.Attributes, clonedTagBuilder.Attributes); 321Assert.Equal(originalTagBuilder.Attributes, clonedTagBuilder.Attributes);