This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add URL resolving TagHelper to replace Razor ~/ functionality. #2807
Comments
One question, about data attributes? I may want to do |
Correct. |
👍 thank you. |
NTaylorMullen
added a commit
that referenced
this issue
Jul 28, 2015
- Razor removed the ability to automatically resolve URLs prefixed with `~/`; therefore `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` have changed to take in `IUrlHelper`s and auto-resolve their URL based properties if they start with `~/`. - Added a catch-all `~/` resolver for non `TagHelper` based HTML elements. Razor used to resolve any attribute value that started with `~/` now the behavior is restricted to attributes that can contain URLs. - Updated `IUrlHelper` to accept `null` values. - Added functional tests to validate that URLs resolve correctly. - Updated `TagHelper` tests to ensure that URLs are resolved via an `IUrlHelper`. #2807
NTaylorMullen
added a commit
that referenced
this issue
Jul 28, 2015
- Razor removed the ability to automatically resolve URLs prefixed with `~/`; therefore `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` have changed to take in `IUrlHelper`s and auto-resolve their URL based properties if they start with `~/`. - Added a catch-all `~/` resolver for non `TagHelper` based HTML elements. Razor used to resolve any attribute value that started with `~/` now the behavior is restricted to attributes that can contain URLs. - Updated `IUrlHelper` to accept `null` values. - Added functional tests to validate that URLs resolve correctly. - Updated `TagHelper` tests to ensure that URLs are resolved via an `IUrlHelper`. #2807
NTaylorMullen
added a commit
that referenced
this issue
Jul 30, 2015
- Razor removed the ability to automatically resolve URLs prefixed with `~/`; therefore `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` have changed to take in `IUrlHelper`s and auto-resolve their URL based properties if they start with `~/`. - Added a catch-all `~/` resolver for non `TagHelper` based HTML elements. Razor used to resolve any attribute value that started with `~/` now the behavior is restricted to attributes that can contain URLs. - Updated `IUrlHelper` to accept `null` values. - Added functional tests to validate that URLs resolve correctly. - Updated `TagHelper` tests to ensure that URLs are resolved via an `IUrlHelper`. #2807
NTaylorMullen
added a commit
that referenced
this issue
Aug 3, 2015
- Razor removed the ability to automatically resolve URLs prefixed with `~/`; therefore `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` have changed to take in `IUrlHelper`s and auto-resolve their URL based properties if they start with `~/`. - Added a catch-all `~/` resolver for non `TagHelper` based HTML elements. Razor used to resolve any attribute value that started with `~/` now the behavior is restricted to attributes that can contain URLs. - Updated `IUrlHelper` to accept `null` values. - Added functional tests to validate that URLs resolve correctly. - Updated `TagHelper` tests to ensure that URLs are resolved via an `IUrlHelper`. #2807
NTaylorMullen
added a commit
that referenced
this issue
Aug 3, 2015
- Razor removed the ability to automatically resolve URLs prefixed with `~/`; therefore `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` have changed to take in `IUrlHelper`s and auto-resolve their URL based properties if they start with `~/`. - Added a catch-all `~/` resolver for non `TagHelper` based HTML elements. Razor used to resolve any attribute value that started with `~/` now the behavior is restricted to attributes that can contain URLs. - Updated `IUrlHelper` to accept `null` values. - Added functional tests to validate that URLs resolve correctly. - Updated `TagHelper` tests to ensure that URLs are resolved via an `IUrlHelper`. #2807
NTaylorMullen
added a commit
that referenced
this issue
Aug 3, 2015
- Razor removed the ability to automatically resolve URLs prefixed with `~/`; therefore `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` have changed to take in `IUrlHelper`s and auto-resolve their URL based properties if they start with `~/`. - Added a catch-all `~/` resolver for non `TagHelper` based HTML elements. Razor used to resolve any attribute value that started with `~/` now the behavior is restricted to attributes that can contain URLs. - Updated `IUrlHelper` to accept `null` values. - Added functional tests to validate that URLs resolve correctly. - Updated `TagHelper` tests to ensure that URLs are resolved via an `IUrlHelper`. #2807
NTaylorMullen
added a commit
that referenced
this issue
Aug 3, 2015
- Razor removed the ability to automatically resolve URLs prefixed with `~/`; therefore `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` have changed to take in `IUrlHelper`s and auto-resolve their URL based properties if they start with `~/`. - Added a catch-all `~/` resolver for non `TagHelper` based HTML elements. Razor used to resolve any attribute value that started with `~/` now the behavior is restricted to attributes that can contain URLs. - Updated `IUrlHelper` to accept `null` values. - Added functional tests to validate that URLs resolve correctly. - Updated `TagHelper` tests to ensure that URLs are resolved via an `IUrlHelper`. #2807
NTaylorMullen
changed the title
Add URL resolving TagHelper to replace Razor ~ functionality.
Add URL resolving TagHelper to replace Razor ~/ functionality.
Aug 24, 2015
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is in reaction to the conversation: aspnet/Razor#427 (comment)
Today Razor special cases
~/
at the beginning of attributes and treats them as "resolve an application relative URL"; however, it does this for every attribute which is overkill/incorrect. After investigating the attributes that have URL capability in Razor the list warrants something less hard coded into the core of Razor to resolve application relative URLs.The list of HTML5 url based attributes I was able to find are:
<a>
,<area>
,<link>
,<base>
<audio>
,<embed>
,<iframe>
,<img>
,<input>
,<script>
,<source>
,<track>
,<video>
<form>
<blockquote>
,<del>
,<ins>
,<q>
<object>
<button>
,<input>
<menuitem>
<html>
<video>
<object>
,<applet>
The
TagHelper
should exist inMicrosoft.AspNet.Mvc.Razor
and should be auto-added to Razor pages (much like how we auto add@inject
directives). It should inspectTagHelperOutput.Attributes
andTagHelperOutput.TagName
for the various combinations listed above and resolve URLs if they begin with~/
. Lastly, it should have an[EditorBrowsable(EditorBrowsableState.Never)]
attribute to prevent excess highlighting in the Razor editor (will work once aspnet/Razor#447 is completed).The text was updated successfully, but these errors were encountered: