Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

A small custom build of Modernizr has been added to Drupal 8 core. It provides the following feature tests to support existing core functionality:

  • inputtypes - tests whether a browser can accept HTML5 <input> types such as date, color, number, range, etc.
  • touch - tests for the existence of touch events in the browser
  • elem_details - tests whether a browser supports the <details> element

It also contains the following utilities that make Modernizr more convenient to use and extend:

  • cssclasses - injects classes into the <html> tag. Classes correspond to the feature test results. Input type classes are not injected, however they are available within the global Modernizr object.
  • addtest - a utility which allows users to create their own feature tests inline.
  • teststyles - allows users to add custom styles to the document and test an element afterwards.
  • prefixes - allows individual tests to remain terse by abstracting vendor prefixes automatically. Ships with -webkit, -moz, -ms, -o.

Impact

Module developers and themers can rely on these tests. For example, a module can now provide touch-specific styles within its admin interface. For example:

.touch .button {
  min-height: 44px;
  min-width: 44px;
}

Read more about feature detection within Drupal

Impacts: 
Module developers
Themers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done