Skip to content

LinkTagHelper fallback test for HTML attributes #14104

@XmlmXmlmX

Description

@XmlmXmlmX

The Problem

I am trying to add a fallback for normalize.css but the normalize.css file doesn't contain any css classes, but attribute selectors.

The Solution

Adding an additional fallback test attribute to be able to test also attribute selectors.

Example:
asp-fallback-test-attribute would be the new additional attribute.

<link rel="stylesheet"
          href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
          asp-fallback-test-attribute="hidden"
          asp-fallback-test-property="display"
          asp-fallback-test-value="none"
          asp-fallback-href="~/lib/normalize.min.css" />

should be rendered like this:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"/>
<meta name="x-stylesheet-fallback-test" content="" class="" hidden>
<script>!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("display","none",["\/lib\/normalize.min.css"], "rel=\u0022stylesheet\u0022 ");</script>

Metadata

Metadata

Assignees

Labels

area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions