-
Notifications
You must be signed in to change notification settings - Fork 224
Add CSS value selectors to TagHelper attributes #684
Comments
Talked with @DamianEdwards and we need to do this in the name of perf for |
Is there something not super complicated that we can do for v1? I'd rather not invent/implement a language for this... |
Spoke with @davidfowl and for now perhaps we just support a callback model instead. e.g. [HtmlTargetElement("a", Attributes = "href", PredicateMethodName = "OnEmitAsTagHelper")]
public class MyTagHelper : TagHelper
{
public static bool OnEmitAsTagHelper(string elementName, TagHelperAttributeList attributes)
{
return attributes["href"].StartsWith("~);
}
} |
Or maybe we create a new context type for this stage, e.g. |
There are at least three perf issues related to the
Do we have current numbers showing whether 1, 2, or 3 is the primary issue for significantly reduced performance when |
The attributes in this case would be allocated during view compilation, so that's not an issue. The example was just pseudo code, so it's likely a different type to pass the attributes to the predicate is better. As for attributes that contain expressions, we need to do the simplest thing for now that preserves the pre-Tag Helpers behavior. |
The work you're suggesting is near equivalent workload to implementing a CSS selector on the |
I think we should do some rapid experiments here to validate some of the ideas. |
Which ideas are you referring to? |
@DamianEdwards and I talked offline and we're gonna go with the CSS selector on |
Hack something up so we can assess whether it actually helps the perf issue. |
I'm fine with RC2 if it looks like it solves the perf problem we have. |
- Added the ability for users to opt into CSS `TagHelper` selectors in their required attributes by surrounding the value with `[` and `]`. Added operators `^`, `$` and `=`. - Added tests to cover code paths used when determining CSS selectors. #684
- Added the ability for users to opt into CSS `TagHelper` selectors in their required attributes by surrounding the value with `[` and `]`. Added operators `^`, `$` and `=`. - Added tests to cover code paths used when determining CSS selectors. #684
- Added the ability for users to opt into CSS `TagHelper` selectors in their required attributes by surrounding the value with `[` and `]`. Added operators `^`, `$` and `=`. - Added tests to cover code paths used when determining CSS selectors. #684
- Added the ability for users to opt into CSS `TagHelper` selectors in their required attributes by surrounding the value with `[` and `]`. Added operators `^`, `$` and `=`. - Added tests to cover code paths used when determining CSS selectors. #684
- Modified `UrlResolutionTagHelper` to utilize new CSS selector attributes to restrict when it applies. It now only appies to tags that have their values starting with `~/`. - `UrlResolutionTagHelper` no longer applies to dynamic content such as `href="@SomethingResultingInTildaSlash"`. - Updated tests to reflect new behavior.
- Added the ability for users to opt into CSS `TagHelper` selectors in their required attributes by surrounding the value with `[` and `]`. Added operators `^`, `$` and `=`. - Added tests to cover code paths used when determining CSS selectors. #684
- Modified `UrlResolutionTagHelper` to utilize new CSS selector attributes to restrict when it applies. It now only appies to tags that have their values starting with `~/`. - `UrlResolutionTagHelper` no longer applies to dynamic content such as `href="@SomethingResultingInTildaSlash"`. - Updated tests to reflect new behavior.
- Added the new `TagHelperRequiredAttributeDescriptor` to the VisualStudio validation test.
Add the ability to do:
This would enable our
UrlResolutionTagHelper
in MVC to only apply when it sees a~/
.The text was updated successfully, but these errors were encountered: