I understand what the asp-fallback-*
tag helpers do. What I don\'t understand is how.
For example:
Ok I think I get it now, by combining @KirkLarkin's answer and common sense.
The sr-only
is applied to a hidden meta
element. If bootstrap is loaded then that element would get a css value of position:absolute
. So that is tested, and if it's so, then it means Bootstrap has been loaded.
So for any library, you need to choose a good example of something only that library can do, and style a hidden tag accordingly, then specify which css style to test, and what value you are expecting.
For javscript it's even easier, because you can just test for the library itself, which usually has some well known variable added to the window
or something to the DOM. So for jQuery it's window.jQuery
, and for Bootstrap it can be tested as window.jQuery && window.jQuery.fn && window.jQuery.fn.modal
and so on.