liveBook · Manning

Asp-fallback-test-property

As explained in Pro ASP.NET Core 7, Tenth Edition

The asp-fallback-test-property attribute specifies the CSS property inspected during a stylesheet fallback test.

asp-fallback-test-property names the CSS property used to verify that a CDN stylesheet loaded before ASP.NET Core supplies its local fallback. section 26.4.2

Configure the fallback test with the related attributes:

  • Set asp-fallback-test-class to a class defined by the CDN stylesheet. section 26.4.2
  • Set asp-fallback-test-property to a property changed by that class. section 26.4.2
  • Set asp-fallback-test-value to the expected computed value; a mismatch triggers the fallback stylesheet. section 26.4.2

Bootstrap CDN fallback

A link can use asp-fallback-test-class="btn", asp-fallback-test-property="display", and asp-fallback-test-value="inline-block". Bootstrap's btn class should produce that display value; if it does not, generated JavaScript adds /lib/bootstrap/css/bootstrap.min.css. section 26.4.2

Table 26.6. The built-in tag helper attributes for link elements (view table figure)

Name

Description

asp-href-include

This attribute is used to select files for the href attribute of the output element.

asp-href-exclude

This attribute is used to exclude files from the href attribute of the output element.

asp-append-version

This attribute is used to enable cache busting, as described in the “Understanding Cache Busting” sidebar.

asp-fallback-href

This attribute is used to specify a fallback file if there is a problem with a CDN.

asp-fallback-href-include

This attribute is used to select files that will be used if there is a CDN problem.

asp-fallback-href-exclude

This attribute is used to exclude files from the set that will be used when there is a CDN problem.

asp-fallback-href-test-class

This attribute is used to specify the CSS class that will be used to test the CDN.

asp-fallback-href-test-property

This attribute is used to specify the CSS property that will be used to test the CDN.

asp-fallback-href-test-value

This attribute is used to specify the CSS value that will be used to test the CDN.

Use the related link tag helper attributes to connect the property test with CDN URLs, fallback files, and fallback-test classes. section 26.4.2

How Pro ASP.NET Core 7, Tenth Edition covers it

How deep it goes
Explains the computed-style mechanism and generated meta and script elements, but does not detail tag helper implementation internals.
Examples
Uses Bootstrap's btn class and its inline-block display value to test a CDN stylesheet.
What it assumes
Assumes familiarity with CSS classes, computed properties, stylesheet links, and ASP.NET Core built-in tag helpers.
What you can do after
Operate/configure a link tag helper that selects a local stylesheet when the CDN test property has the wrong value.
How it connects
Connects CSS classes and properties with CDN loading, fallback stylesheets, Bootstrap, and ASP.NET Core link tag helpers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro ASP.NET Core 7, Tenth Edition. The section links point to the parts of the book it draws on.