- This involved adding the StringComparer.OrdinalIgnoreCase comparer to the TagBuilder's Attributes dictionary.
- Added tests to validate that all methods that made use of TagBuilder.Attributes abide by the new ignore case mechanic.
- Added two sets of tests to validate the new functionality of Object => Dictionary HTML helper tests.
- Modified a functional test that utilizes HTML Helpers to provide same attribute-different case objects.
- Fixed existing HTML helper tests to account for new ordering of attrbutes (dictionary no longer adds key value pairs, it sets them).
#1328
- #704 part 2 of 2
- change `@Html.Id()` to sanitize return value; was identical to `@Html.Name()`
Copied `TagBuilder.CreateSanitizedId()` and `TagBuilder.Html401IdUtil` from MVC 5.2
- except this `CreateSanitizedId()` returns a valid identifier if first `char` is not a letter
- e.g. "[0].Name"
nits:
- expand variable names, use lots of `var`, put `public` members first
- add doc comments for `CreateSanitizedId()`
Note users will be able to apply different sanitization once we fix#1188.
- make a few more methods available as `internal static` in `DefaultHtmlGenerator`
- remove `IHtmlGenerator.GenerateOption()`; now `internal static`
nits:
- add `IHtmlGenerator.IdAttributeDotReplacement`
- move `DefaultHtmlGenerator.IdAttributeDotReplacement` after constructor
- move `HtmlHelper.ActionLink()` below static methods
- move newly-`internal` methods together in `DefaultHtmlGenerator`
- correct placement of `DefaultHtmlGenerator.GetValidationAttributes()` comment
- part of #1243 (kind-of)
- mostly copied from `HtmlHelper` but refactored to
- consistently take a `ViewContext` parameter and return a `TagBuilder`
- provide `GenerateActionLink()` and `GenerateRouteLink()`
- provide a separate `GenerateHiddenForCheckBox()`, allowing
`GenerateCheckBox()` to return a `TagBuilder`
- `GenerateForm()`'s `method` parameter is a `string`, not `FormMethod`
nits: format document, consistent line wrapping, variable name changes, ...
Html.PartialAsync
* Introducing StringCollectionTextWriter to buffer the contents of
PartialAsync
* Ensure DecorateWriter is called for partial views
Fixes#1266
- #847 line 1: copy XML comments from interfaces to extension methods
- lots of wording changes to be more consistent
- core text split from PR #866, where @rynowak and I hashed out the words
- to extent possible, reuse words between method descriptions
- add a few missing `<param/>` and `<typeparam/>` elements and fill in empty ones
- display more HTML elements as tags
- use `<c>true|false|null</c>` more often
- add `<remarks/>` describing behaviour of input helpers e.g. `CheckBox()`
- add `<remarks/>` explaining "renders"
- add `<remarks/>` containing example expression names
nits:
- "The expression" -> "An expression"
- make examples for `ObjectToDictionary()` and `AnonymousObjectToHtmlAttributes()` more consistent
- move `<typeparam/>` elements (that existed) after all `<param/>` elements
- explain "checked" attributes better, removing some duplicated words from the `RadioButton[For]()` descriptions
- correct `routeValues` description in `GenerateForm()` comments
- correct XML comment typo introduced in `HtmlHelper` in 56d66c090e (bad merge)
- fix missed `null` requirement for `@Html.RadioButtonFor()` and remove buried `null` check
- add back `Environment.Newline` to `@Html.TextArea()` (was dropped though comment wasn't)
- #874 lines 3, 4, and 6
- correct `Value()` to treat a `null` expression name the same as `string.Empty`
- add missing `[NotNull]` attributes in `EditorExtensions` and for `GenerateIdFromName()`
- consistently pass `null` for default expression names to the helpers
- for example, from extension methods
- add test cases using `null` for expression name
nits:
- correct summary XML comment for `HtmlHelper` class
- use named parameters and prefer interface (not extension) methods in changed calls
- use `string.Empty` instead of `""` in a few tests
- fix problems at least with Roslyn compiler and VS IntelliSense or the Object Browser
- `<see langref="keyword"/>` generates nothing
- `<example>` at top level (outside `<summary>`) generates nothing
- curly braces don't become angle brackets outside `<see cref="reference"/>` references
- yeah, a point @yishaigalatzer asked about in a previous PR
- `<see href="reference"/>` is not valid
- correct some invalid use of angle brackets and remove useless empty elements
- correct unresolved XML comment references; generally, add namespace prefix
Symptoms for some of the above issues included
- generated XML comments such as `<!-- Badly formed XML comment ... -->`, usually indicating an unclosed element
- generated XML attributes such as `cref="!:..."`, indicating a broken reference
- in a couple of cases we had `<typeparamref cref="TOption"/>`; attribute should be `"name"`
Few wording changes beyond
- `"opening </form> tag"` -> `"<form> start tag"`
- `"closing </form> tag"` -> `"</form> end tag"`
Also correct two typos in `HtmlHelper`
Will create a unit test to ensure XML syntax doesn't degrade going forward. Separate PR.
- for now, check using `dir -r *.xml | sls '!'`
- see line 2 of #874
- focus on `TextBox[For]()` and `ValidationSummary()`
related fixes included here:
- `TextArea[For]()` documentation incorrectly indicated their `htmlAttributes` parameters were dictionaries
- handle `htmlAttributes` parameters more consistently; create a dictionary only when necessary
- fixes#566 and part of #847
- allows compositions such as `@Html.Label("property", Html.Id("property"))`
and `@Html.Raw(Html.DisplayText("property"))` (this one is not recommended)
- adjust XML comments to match
- add missing XML comments to `HtmlHelperValueExtensions`
- nit: `TInnerModel` -> `TModelItem`
- increase XML comment consistency for changed methods
- generally make wording more consistent e.g. how we use words such as
"returns"
- use `<see langref="string|true|false|null"/>` more
- address all of #659 and a bit of #874 (avoid `public virtual` methods in
`HtmlHelper`)
- make `MetadataProvider` and `GetClientValidationRules()` `public` and
therefore available to extension methods
- remove unused `GetValidationAttributes()` overload
- make remaining `GetValidationAttributes()` overload (and not
`GetClientValidationRules()`) `virtual`, allowing derived classes to
change the attributes without overriding all callers
- reverse `GetValidationAttributes()` and `GetClientValidationRules()`
parameter order to match precedence
- add `GenerateName()` and `GenerateValidationSummary()` to make
`protected virtual` method names consistent
- `Name()`, `ValidationSummary()` and `TextArea()` are no longer `virtual`
because `protected virtual Generate*()` methods exist for all
- remove `ViewContext.UnobtrusiveJavaScriptEnabled` property and all references
- avoid `ViewContext.GetFormContextForClientValidation()` calls since
ternary expression is more explicit and we were inconsistent
- improve `ValidationMessage()` comments
- don't treat `ModelState.IsValid` as if it were still nullable
- value comes from `Name` property of `[Display]` attribute
- use new property in `@Html.DisplayName()` and `@Html.Label()`; remove associated TODO comments
This change enables user to specify the tag for the wrapping HTML element
generated from ValidationSummary() and ValidationMessage[For]().
Clean up HtmlHelperValidationExtensions.
should consider the application base path
- `request.BasePath` was indeed ignored
- also simplify `formAction` calculation using the higher-level
`PathString.Add()` overloads
- use the request's Path and QueryString rather than default Action() return
value
- actual special case detects all parameter values match the defaults
- this slightly expands the scenarios where the query string is added but
removes an odd inconsistency between `html.BeginForm()` and (say)
`html.BeginForm(FormMethod.Post)`
Fixes#278
- copy from legacy MVC
- get `ListBox[For]()` methods in correct places and working
- also usual stuff: `var`, `[NotNull]`, remove `IDictionary<,>` overloads
- `ListBoxHelper()` -> `GenerateListBox`
- already had all the bits needed in `GenerateSelect()`
- special-case `null` or empty `name` in GenerateSelect()
- ensure `ArgumentException` has correct parameter name
- lower-level problem affected `CheckBox()` as well
- use `ListBox()` and `ListBoxFor()` in MVC sample
- use `ListBox()` in an editor template
- copy over legacy `Editor*()` extensions and default editor templates
- get working in the new world
- usual `var`, `String` -> `string`, `internal` -> `public`, namespaces, ...
- longest overloads into `IHtmlHelper[<TModel>]` and implementation classes
- clean up `ViewContext.ViewData` -> `ViewData`, trailing whitespace, long lines
- remove `MultilineTextTemplate()` since `TextArea()` doesn't exist yet
- remove `ColorInputTemplate()` since `Color` type doesn't exist
- use `html.Label()`, not `LabelExtensions.LabelHelper()`: equivalent helper
is protected. only downside is potential `ModelMetadata` re-discovery.
- rename `HtmlInputTemplateHelper()` -> `GenerateTextBox()`
- copy over `Html5DateRenderingMode` and `html.Html5DateRenderingMode` property
- and get them working in new world
- hook the default editor templates up
- use `Editor()`, `EditorFor()`, `EditorForModel()` in MVC sample
- add an on-disk editor template to MVC sample
- no more `IHtmlHelper<object>` in `DefaultDisplayTemplates` and also no
need for `ViewDataDictionary<object>` in a few places
- mostly removals from `IHtmlHelper<TModel>` but did cleanup comments and
add `[NotNull]` for `DisplayFor()`, `DisplayNameFor()`,
`DisplayNameForInnerType()`, and `LabelFor()`
- also add `[NotNull]` for `this` and `Expression` parameters in some
extension methods
- Config is cleaned up to not have IAdditionalDataProvider and SuppressIdentityChecks.
- Added a DefaultClaimUidExtractor which looks for NameIdentifier and if not present serializes entire claims.
- Added HtmlHelper.
- AntiForgery now returns an AntiForgeryTokenSet which represents a tuple of cookie and form tokens.
- first get old code in correct spot
- then get default templates working in new world
- usual things: `[NotNull]`, `var`, internal -> public
- provide a `HtmlHelper.GenerateOption()` static method
- pass an `ViewDataDictionary<object>` instance to `TemplateRenderer` constructor
- run default templates synchronously with an IHtmlHelper<object>
- copy over resources
- add Microsoft.Data.Entity reference for EntityState type
- use default templates in MVC sample
- remove most on-disk overrides of the default templates
- copy over legacy MVC's `SelectExtensions`, `SelectListItem` and `SelectListGroup`
- plus expected `SelectList` and `MultiSelectList`
- fixup select HTML helpers to meet WebFx standards and work in new world
- usual stuff: `[NotNull]`, `var`, `String` -> `string`, long lines, ...
- remove `IDictionary<string, object> htmlAttributes` overloads
- move longest extension method overloads into correct classes / interfaces
- add `ViewDataEvaluator.Eval()` overload for an `object` container
- rename lower-level helpers to make purposes more obvious
- nit: move Raw() methods up from bottom of HtmlHelper.cs
- use `DropDownList[For]()` in MVC sample