213 references to AddAttribute
Microsoft.AspNetCore.Components.Endpoints (1)
Assets\ImportMap.cs (1)
64
builder.
AddAttribute
(1, "type", "importmap");
Microsoft.AspNetCore.Components.Performance (17)
RenderTreeDiffBuilderBenchmark.cs (17)
27
original.
AddAttribute
(1, "class", "form-group");
30
original.
AddAttribute
(3, "class", "control-label");
31
original.
AddAttribute
(4, "for", "name");
37
original.
AddAttribute
(8, "class", "form-control");
38
original.
AddAttribute
(9, "type", "text");
39
original.
AddAttribute
(10, "name", "name"); // Notice the gap in sequence numbers
40
original.
AddAttribute
(12, "value", "");
44
original.
AddAttribute
(14, "class", "text-danger field-validation-valid");
53
modified.
AddAttribute
(1, "class", "form-group");
56
modified.
AddAttribute
(3, "class", "control-label");
57
modified.
AddAttribute
(4, "for", "name");
63
modified.
AddAttribute
(8, "class", "form-control");
64
modified.
AddAttribute
(9, "type", "text");
65
modified.
AddAttribute
(10, "name", "name");
66
modified.
AddAttribute
(11, "data-validation-state", "invalid");
67
modified.
AddAttribute
(12, "value", "Lamborghini");
71
modified.
AddAttribute
(14, "class", "text-danger field-validation-invalid"); // changed
Microsoft.AspNetCore.Components.Tests (127)
RendererTest.cs (3)
5487
builder.
AddAttribute
(1, "type", "checkbox");
5492
builder.
AddAttribute
(5, "value", BindConverter.FormatValue(SomeStringProperty));
5911
builder.
AddAttribute
(1, nameof(BoundString), BoundString);
Rendering\RenderTreeBuilderTest.cs (32)
239
builder.
AddAttribute
(0, "attribute1", "value 1"); // 1: attribute1="value 1"
284
builder.
AddAttribute
(0, "attribute1", "value 1");
302
builder.
AddAttribute
(0, "attribute4", (string)null);
304
builder.
AddAttribute
(0, "attribute7", "the end");
330
builder.
AddAttribute
(0, "attribute1", "value1");
437
builder.
AddAttribute
(0, "name", "value");
478
builder.
AddAttribute
(2, "name", "value");
522
builder.
AddAttribute
(1, "name", "value");
551
builder.
AddAttribute
(2, "name", "value");
566
builder.
AddAttribute
(2, "name", "value");
636
builder.
AddAttribute
(12, "child1attribute1", "A"); // 2: child1attribute1="A"
637
builder.
AddAttribute
(13, "child1attribute2", "B"); // 3: child1attribute2="B">
640
builder.
AddAttribute
(15, "child2attribute", "C"); // 5: child2attribute="C">
987
builder.
AddAttribute
(1, "attr", "hi");
1005
builder.
AddAttribute
(1, "attr", (string)null);
1024
builder.
AddAttribute
(1, "attr", value);
1697
builder.
AddAttribute
(1, "attribute before", "before value");
1699
builder.
AddAttribute
(2, "attribute after", "after value");
1818
builder.
AddAttribute
(0, "id", "hi");
1819
builder.
AddAttribute
(0, "id", "bye");
1841
builder.
AddAttribute
(0, "id", "hi");
1866
builder.
AddAttribute
(0, "id", "hi");
1891
builder.
AddAttribute
(0, "id", "hi");
1914
builder.
AddAttribute
(0, "id", "hi");
1938
builder.
AddAttribute
(0, "id", (string)null);
1961
builder.
AddAttribute
(0, "id", "hi");
1967
builder.
AddAttribute
(0, "id", "hi");
1968
builder.
AddAttribute
(0, "id", "bye");
1991
builder.
AddAttribute
(0, "A", "hi");
1999
builder.
AddAttribute
(0, "3", "see ya"); // Overwrite value added by splat
2001
builder.
AddAttribute
(0, "5", "another one");
2274
builder.
AddAttribute
(2, "a", "b");
RenderTreeDiffBuilderTest.cs (86)
60
builder.
AddAttribute
(1, "My attribute", "My value");
837
oldTree.
AddAttribute
(1, "existing", "existing value");
840
newTree.
AddAttribute
(1, "existing", "existing value");
841
newTree.
AddAttribute
(2, "added", "added value");
862
oldTree.
AddAttribute
(1, "will be removed", "will be removed value");
863
oldTree.
AddAttribute
(2, "will survive", "surviving value");
866
newTree.
AddAttribute
(2, "will survive", "surviving value");
886
oldTree.
AddAttribute
(1, "will remain", "will remain value");
887
oldTree.
AddAttribute
(2, "will change", "will change value");
890
newTree.
AddAttribute
(1, "will remain", "will remain value");
891
newTree.
AddAttribute
(2, "will change", "did change value");
946
oldTree.
AddAttribute
(1, "oldname", "same value");
949
newTree.
AddAttribute
(1, "newname", "same value");
975
oldTree.
AddAttribute
(0, "attr2", "value2");
976
oldTree.
AddAttribute
(0, "attr3", "value3");
979
newTree.
AddAttribute
(0, "attr1", "value1");
980
newTree.
AddAttribute
(0, "attr2", "value2");
981
newTree.
AddAttribute
(0, "attr3", "value3");
1005
oldTree.
AddAttribute
(0, "attr1", "value1");
1006
oldTree.
AddAttribute
(0, "attr3", "value3");
1009
newTree.
AddAttribute
(0, "attr1", "value1");
1010
newTree.
AddAttribute
(0, "attr2", "value2");
1011
newTree.
AddAttribute
(0, "attr3", "value3");
1036
oldTree.
AddAttribute
(0, "attr1", "value1");
1037
oldTree.
AddAttribute
(0, "attr2", "value2");
1040
newTree.
AddAttribute
(0, "attr1", "value1");
1041
newTree.
AddAttribute
(0, "attr2", "value2");
1042
newTree.
AddAttribute
(0, "attr3", "value3");
1067
oldTree.
AddAttribute
(2, "attr2", "value2");
1068
oldTree.
AddAttribute
(3, "attr3", "value3");
1071
newTree.
AddAttribute
(1, "attr1", "value1");
1072
newTree.
AddAttribute
(2, "attr2", "value2");
1073
newTree.
AddAttribute
(3, "attr3", "value3");
1097
oldTree.
AddAttribute
(1, "attr1", "value1");
1098
oldTree.
AddAttribute
(3, "attr3", "value3");
1101
newTree.
AddAttribute
(1, "attr1", "value1");
1102
newTree.
AddAttribute
(2, "attr2", "value2");
1103
newTree.
AddAttribute
(3, "attr3", "value3");
1128
oldTree.
AddAttribute
(1, "attr1", "value1");
1129
oldTree.
AddAttribute
(2, "attr2", "value2");
1132
newTree.
AddAttribute
(1, "attr1", "value1");
1133
newTree.
AddAttribute
(2, "attr2", "value2");
1134
newTree.
AddAttribute
(3, "attr3", "value3");
1159
oldTree.
AddAttribute
(0, "attr1", "value1");
1160
oldTree.
AddAttribute
(0, "attr2", "value2");
1161
oldTree.
AddAttribute
(0, "attr3", "value3");
1164
newTree.
AddAttribute
(0, "attr2", "value2");
1165
newTree.
AddAttribute
(0, "attr3", "value3");
1186
oldTree.
AddAttribute
(0, "attr1", "value1");
1187
oldTree.
AddAttribute
(0, "attr2", "value2");
1188
oldTree.
AddAttribute
(0, "attr3", "value3");
1191
newTree.
AddAttribute
(0, "attr1", "value1");
1192
newTree.
AddAttribute
(0, "attr3", "value3");
1213
oldTree.
AddAttribute
(0, "attr1", "value1");
1214
oldTree.
AddAttribute
(0, "attr2", "value2");
1215
oldTree.
AddAttribute
(0, "attr3", "value3");
1218
newTree.
AddAttribute
(0, "attr1", "value1");
1219
newTree.
AddAttribute
(0, "attr2", "value2");
1240
oldTree.
AddAttribute
(1, "attr1", "value1");
1241
oldTree.
AddAttribute
(2, "attr2", "value2");
1242
oldTree.
AddAttribute
(3, "attr3", "value3");
1245
newTree.
AddAttribute
(2, "attr2", "value2");
1246
newTree.
AddAttribute
(3, "attr3", "value3");
1267
oldTree.
AddAttribute
(1, "attr1", "value1");
1268
oldTree.
AddAttribute
(2, "attr2", "value2");
1269
oldTree.
AddAttribute
(3, "attr3", "value3");
1272
newTree.
AddAttribute
(1, "attr1", "value1");
1273
newTree.
AddAttribute
(3, "attr3", "value3");
1294
oldTree.
AddAttribute
(1, "attr1", "value1");
1295
oldTree.
AddAttribute
(2, "attr2", "value2");
1296
oldTree.
AddAttribute
(3, "attr3", "value3");
1299
newTree.
AddAttribute
(1, "attr1", "value1");
1300
newTree.
AddAttribute
(2, "attr2", "value2");
1682
newTree.
AddAttribute
(0, "another-attribute", "go down the slow path please");
2223
oldTree.
AddAttribute
(1, "attr1", "unrelated val1");
2227
newTree.
AddAttribute
(1, "attr1", "unrelated val1");
2254
oldTree.
AddAttribute
(1, "attr1", "unrelated val1");
2262
newTree.
AddAttribute
(1, "attr1", "unrelated val1");
2284
newTree.
AddAttribute
(1, "attr1", "unrelated val1");
2336
oldTree.
AddAttribute
(1, $"myattribute_{i}", "value");
2341
newTree.
AddAttribute
(1, $"myattribute_{i}", "value");
2345
newTree.
AddAttribute
(1, $"myattribute_final", "value");
2369
oldTree.
AddAttribute
(1, $"myattribute_{i}", "value");
2374
newTree.
AddAttribute
(1, $"myattribute_{i}", "value");
2378
oldTree.
AddAttribute
(1, $"myattribute_final", "value");
2449
builder.
AddAttribute
(1, "attrib", attributeValue);
RenderTreeUpdaterTest.cs (6)
22
builder.
AddAttribute
(2, valuePropName, "initial value");
50
builder.
AddAttribute
(2, valuePropName, "initial value");
75
builder.
AddAttribute
(2, valuePropName, "unchanged 1");
80
builder.
AddAttribute
(5, "unrelated prop before", "unchanged 2");
81
builder.
AddAttribute
(6, valuePropName, "initial value");
82
builder.
AddAttribute
(7, "unrelated prop after", "unchanged 3");
Microsoft.AspNetCore.Components.Web (34)
Forms\AntiforgeryToken.cs (3)
43
builder.
AddAttribute
(1, "type", "hidden");
44
builder.
AddAttribute
(2, "name", _requestToken!.FormFieldName);
45
builder.
AddAttribute
(3, "value", _requestToken.Value);
Forms\EditForm.cs (2)
144
builder.
AddAttribute
(2, "method", "post");
149
builder.
AddAttribute
(3, "data-enhance", "");
Forms\InputCheckbox.cs (3)
36
builder.
AddAttribute
(2, "type", "checkbox");
38
builder.
AddAttribute
(4, "class", CssClass);
43
builder.
AddAttribute
(6, "value", bool.TrueString);
Forms\InputDate.cs (3)
88
builder.
AddAttribute
(2, "type", _typeAttributeValue);
90
builder.
AddAttribute
(4, "class", CssClass);
91
builder.
AddAttribute
(5, "value", CurrentValueAsString);
Forms\InputFile.cs (1)
62
builder.
AddAttribute
(2, "type", "file");
Forms\InputNumber.cs (3)
55
builder.
AddAttribute
(1, "step", _stepAttributeValue);
56
builder.
AddAttribute
(2, "type", "number");
60
builder.
AddAttribute
(6, "value", CurrentValueAsString);
Forms\InputRadio.cs (4)
68
builder.
AddAttribute
(3, "type", "radio");
69
builder.
AddAttribute
(4, "name", Context.GroupName);
70
builder.
AddAttribute
(5, "value", BindConverter.FormatValue(Value?.ToString()));
71
builder.
AddAttribute
(6, "checked", Context.CurrentValue?.Equals(Value) == true ? GetToggledTrueValue() : null);
Forms\InputSelect.cs (2)
49
builder.
AddAttribute
(5, "value", BindConverter.FormatValue(CurrentValue)?.ToString());
55
builder.
AddAttribute
(7, "value", CurrentValueAsString);
Forms\InputText.cs (1)
38
builder.
AddAttribute
(4, "value", CurrentValueAsString);
Forms\InputTextArea.cs (1)
38
builder.
AddAttribute
(4, "value", CurrentValueAsString);
Forms\RenderTreeBuilderExtensions.cs (1)
15
builder.
AddAttribute
(sequence, name, value);
Forms\ValidationMessage.cs (1)
74
builder.
AddAttribute
(1, "class", "validation-message");
Forms\ValidationSummary.cs (2)
76
builder.
AddAttribute
(1, "class", "validation-errors");
81
builder.
AddAttribute
(4, "class", "validation-message");
Routing\FocusOnNavigate.cs (1)
70
builder.
AddAttribute
(1, "selector", Selector);
Routing\NavLink.cs (2)
165
builder.
AddAttribute
(2, "class", CssClass);
168
builder.
AddAttribute
(3, "aria-current", "page");
Virtualization\Virtualize.cs (3)
225
builder.
AddAttribute
(1, "style", GetSpacerStyle(_itemsBefore));
286
builder.
AddAttribute
(8, "style", GetSpacerStyle(itemsAfter, _unusedItemCapacity));
460
builder.
AddAttribute
(1, "style", $"height: {_itemSize.ToString(CultureInfo.InvariantCulture)}px; flex-shrink: 0;");
Web\ErrorBoundary.cs (1)
48
builder.
AddAttribute
(3, "class", "blazor-error-boundary");
Microsoft.AspNetCore.Components.Web.Tests (34)
Forms\Mapping\FormMappingScopeTest.cs (5)
33
builder.
AddAttribute
(1, nameof(FormMappingScope.Name), "named-context");
55
b.
AddAttribute
(1, nameof(FormMappingScope.Name), "child-context");
63
builder.
AddAttribute
(1, nameof(FormMappingScope.Name), "parent-context");
85
builder.
AddAttribute
(1, nameof(FormMappingScope.Name), name);
120
builder.
AddAttribute
(1, nameof(FormMappingScope.Name), contextName);
HtmlRendering\HtmlRendererTest.cs (28)
144
rtb.
AddAttribute
(1, "class", "lead");
175
rtb.
AddAttribute
(1, "class", "test1");
176
rtb.
AddAttribute
(2, "another", "another-value");
201
rtb.
AddAttribute
(1, "class", "<lead");
337
rtb.
AddAttribute
(2, "unrelated-attribute-before", "a");
338
rtb.
AddAttribute
(3, "value", "b");
339
rtb.
AddAttribute
(4, "unrelated-attribute-after", "c");
343
rtb.
AddAttribute
(6, "unrelated-attribute", "a");
344
rtb.
AddAttribute
(7, "value", optionValue);
352
rtb.
AddAttribute
(10, "value", "b");
377
rtb.
AddAttribute
(1, "value", "Hello <html>-encoded content!");
378
rtb.
AddAttribute
(2, "rows", "10");
379
rtb.
AddAttribute
(3, "cols", "20");
402
rtb.
AddAttribute
(1, "rows", "10");
403
rtb.
AddAttribute
(2, "cols", "20");
427
rtb.
AddAttribute
(1, "rows", "10");
428
rtb.
AddAttribute
(2, "cols", "20");
451
rtb.
AddAttribute
(1, "value", "Hello World!");
475
rtb.
AddAttribute
(1, "value", "Hello <html>-encoded content!");
476
rtb.
AddAttribute
(2, "id", "Test");
522
rtb.
AddAttribute
(1, "value", "Hello <html>-encoded content!");
523
rtb.
AddAttribute
(2, "id", "Test");
552
rtb.
AddAttribute
(1, "value", "beta");
558
rtb.
AddAttribute
(4, "value", optionValue);
594
rtb.
AddAttribute
(4, "Value", "Child content!");
625
rtb.
AddAttribute
(4, "Value", "Child content!");
1148
rtb.
AddAttribute
(1, "method", "post");
1170
rtb.
AddAttribute
(1, "action", "https://example.com/explicit");
Virtualization\VirtualizeTest.cs (1)
135
builder.
AddAttribute
(1, "style", "overflow: auto; height: 800px;");