-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Update HtmlHelper
to use IHtmlGenerator
#1348
Conversation
ca63b8b
to
511285d
Compare
0647d8c
to
2ed038a
Compare
rebased on latest TagHelperFeature, which I rebased on origin/dev just a bit ago |
/cc @NTaylorMullen or @pranavkm and @sornaks (who should have some familiarity with the changed |
return HtmlString.Empty; | ||
} | ||
|
||
return tagBuilder.ToHtmlString(TagRenderMode.Normal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if you think it's cleaner you could do across the board:
return tagBuilder?.ToHtmlString(TagRenderMode.Normal) ?? HtmlString.Empty;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
definitely less clean. also uselessly null
-checks the ToHtmlString()
return value.
Holy massive change. I have to say it does make me a bit nervous having suchhh a large change set without #453 in. |
we do have a few tests that cover the helpers. I've also checked the MVC sample out... |
var byteArrayValue = value as byte[]; | ||
if (byteArrayValue != null) | ||
var tagBuilder = | ||
_htmlGenerator.GenerateHidden(ViewContext, metadata, name, value, useViewData, htmlAttributes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you format it so that the parameters are in separate lines (like the MvcForm) above? Makes it seem more consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
…scussion - lots of new comments in Create.cshtml
- 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, ...
- add version to Microsoft.AspNet.Mvc.TagHelpers/project.json - also turn on warnings-as-errors
- enable MVC tag helpers in TagHelperSample.Web - also fix a couple of issues in TagHelperSample.Web
511285d
to
ce38d26
Compare
2ed038a
to
d576aec
Compare
|
- 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
3a30e87
to
de5884f
Compare
ce38d26
to
50f7748
Compare
Checked into TagHelperFeature w/ commit 50f7748 |
<textarea/>
and other MVC tag helpers #1243; previous commit did not get everything usingIHtmlGenerator
internal static
inDefaultHtmlGenerator
IHtmlGenerator.GenerateOption()
; nowinternal static
nits:
IHtmlGenerator.IdAttributeDotReplacement
DefaultHtmlGenerator.IdAttributeDotReplacement
after constructorHtmlHelper.ActionLink()
below static methodsinternal
methods together inDefaultHtmlGenerator
DefaultHtmlGenerator.GetValidationAttributes()
comment