Skip to content

Add fallback tests based on css pseudo-elements #38146

Open
@dasblinkenlight

Description

@dasblinkenlight

Motivation:

CSS for a popular CDN package Bootstrap Icons consists entirely of pseudo-element definitions, such as below:

.bi::before {
  display: inline-block;
  font-family: bootstrap-icons !important;
   ...
}

The current implementation of the ASP.NET fallback tester offers no support for pseudo-elements, because the JavaScript for the tester calls a single-parameter overload of getComputedStyle. To test pseudo-elements, we need to pass the name of the the pseudo-element to be tested as a second parameter of getComputedStyle.

Solution:

We add support for testing pseudo-elements by setting an asp-fallback-test-pseudo-element attribute:

...
asp-fallback-test-class="bi"
asp-fallback-test-pseudo-element="before"
...

We then pass the value of the asp-fallback-test-pseudo-element as the second parameter to the fallback tester function, which then forwards it to getComputedStyle; if no value is specified, we pass null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ui-renderingIncludes: MVC Views/Pages, Razor Views/PagesenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-mvc-razor-viewsFeatures related to the Razor view engine for Razor pages and MVC views

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions