Difference between asp-fallback-test-property vs asp-fallback-test
Difference between asp-fallback-test-property vs asp-fallback-test
asp-fallback-test-property
is specific to the link
tag-helper. It's the name of a CSS property you want to be interrogated, with asp-fallback-test-value
being the value you expect it to have (see the previous answer I wrote for the specifics).
asp-fallback-test
is specific to the script
tag-helper. It's just a JavaScript expression that will be evaluated - if it's truthy, no fallback will be used.
As an example of asp-fallback-test
, imagine the following script
tag:
<script src="/some/cdn/to/jquery"
asp-fallback-src="~/local/path/to/jquery"
asp-fallback-test="window.jQuery"></script>
In this example, after the browser attempts to load the script from /some/cdn/to/jquery
, the tag-helper will check whether window.jQuery
is truthy. If it is, there's nothing more to do. If it isn't (the CDN script couldn't be downloaded), it will inject a script
tag for ~/local/path/to/jquery
.
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/script-tag-helper?view=aspnetcore-5.0
Commonly used Script Tag Helper attributes
See Script Tag Helper for all the Script Tag Helper attributes, properties, and methods.
asp-fallback-test
The script method defined in the primary script to use for the fallback test. For more information, see FallbackTestExpression.
asp-fallback-src
The URL of a Script tag to fallback to in the case the primary one fails. For more information, see FallbackSrc.
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/link-tag-helper?view=aspnetcore-5.0
href
Preferred address of the linked resource. The address is passed thought to the generated HTML in all cases.
asp-fallback-href
The URL of a CSS stylesheet to fallback to in the case the primary URL fails.
asp-fallback-test-class
The class name defined in the stylesheet to use for the fallback test. For more information, see FallbackTestClass.
asp-fallback-test-property
The CSS property name to use for the fallback test. For more information, see FallbackTestProperty.
asp-fallback-test-value
The CSS property value to use for the fallback test. For more information, see FallbackTestValue.
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2020-09-22 What is an example of the Liskov Substitution Principle?
2020-09-22 Data Science Bootcamp
2020-09-22 How to POST using HTTPclient content type = application/x-www-form-urlencoded
2020-09-22 C# HttpWebRequest of type “application/x-www-form-urlencoded” - how to send '&' character in content body?
2020-09-22 How can I supply an AntiForgeryToken when posting JSON data using $.ajax?
2016-09-22 使用entityframework操作sqlite数据库
2016-09-22 excel在一个图表内,显示折线图和柱状图