1. Introduction
This section is non-normative.There exists an increasingly large corpus of web content that depends on web browsers supporting a
number of specific vendor CSS properties and DOM APIs for functionality or layout.
This holds especially true for mobile-optimized web content, which is highly dependent on -webkit-
-prefixed properties.
This specification aims to describe the minimal set of -webkit-
-prefixed CSS properties
and DOM APIs that user agents are required to support for web compatibility, which aren’t
specified elsewhere.
The HTTP User-Agent
header field as found in major browsers today is also described.
2. Conformance
All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative.The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. For readability, these words do not appear in all uppercase letters in this specification. [RFC2119]
Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and terminate these steps") are to be interpreted with the meaning of the keyword ("must", "should", "may", etc.) used in introducing the algorithm.
Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be easy to follow, and not intended to be performant.)
3. CSS Compatibility
3.1. CSS At-rules
The following -webkit-
vendor prefixed at-rules must be supported as aliases
of the corresponding unprefixed at-rules:
-webkit- prefixed at-rule alias
| unprefixed at-rule |
---|---|
@-webkit-keyframes
| @keyframes
|
3.2. CSS Media Queries
3.2.1. -webkit-device-pixel-ratio
Name: | -webkit-device-pixel-ratio |
---|---|
For: | @media |
Value: | <number> |
Type: | range |
-webkit-device-pixel-ratio
must be treated as an alias of the resolution
range type media feature, with its value interpreted as a dppx unit.
The min-
or max-
prefixes on range features must not apply to -webkit-device-pixel-ratio
, instead the following aliases must be used:
legacy -webkit- prefixed range media feature alias
| standard prefixed range media feature |
---|---|
-webkit-min-device-pixel-ratio
| min-resolution
|
-webkit-max-device-pixel-ratio
| max-resolution
|
3.2.2. -webkit-transform-3d
Name: | -webkit-transform-3d |
---|---|
For: | @media |
Value: | <mq-boolean> |
Type: | discrete |
The -webkit-transform-3d
media feature is used to query whether the
user agent supports CSS 3D transforms. [css-transforms-1]
If the user agent supports 3D transforms, the value will be 1. Otherwise the value is 0.
3.3. CSS Gradient Functions
3.3.1. -webkit-linear-gradient()
The -webkit-linear-gradient()
gradient function must be treated
as an alias of linear-gradient as defined in [css3-images-20110217].
3.3.2. -webkit-radial-gradient()
The -webkit-radial-gradient()
gradient function must be treated
as an alias of radial-gradient as defined in [css3-images-20110217].
3.3.3. -webkit-repeating-linear-gradient()
The -webkit-repeating-linear-gradient()
gradient function must be
treated as an alias of repeating-linear-gradient as defined in [css3-images-20110217].
3.3.4. -webkit-repeating-radial-gradient()
The -webkit-repeating-radial-gradient()
gradient function must be
treated as an alias of repeating-radial-gradient as defined in [css3-images-20110217].
3.4. CSS Properties
3.4.1. Legacy name aliases
The following -webkit-
vendor prefixed properties must be supported as legacy name aliases of the corresponding unprefixed property:
-webkit- prefixed property alias
| unprefixed property |
---|---|
-webkit-align-items
| align-items
|
-webkit-align-content
| align-content
|
-webkit-align-self
| align-self
|
-webkit-animation-name
| animation-name
|
-webkit-animation-duration
| animation-duration
|
-webkit-animation-timing-function
| animation-timing-function
|
-webkit-animation-iteration-count
| animation-iteration-count
|
-webkit-animation-direction
| animation-direction
|
-webkit-animation-play-state
| animation-play-state
|
-webkit-animation-delay
| animation-delay
|
-webkit-animation-fill-mode
| animation-fill-mode
|
-webkit-animation
| animation
|
-webkit-backface-visibility
| backface-visibility
|
-webkit-background-clip
| background-clip
|
-webkit-background-origin
| background-origin
|
-webkit-background-size
Not really a legacy name alias. See issue #28. | background-size
|
-webkit-border-bottom-left-radius
| border-bottom-left-radius
|
-webkit-border-bottom-right-radius
| border-bottom-right-radius
|
-webkit-border-top-left-radius
| border-top-left-radius
|
-webkit-border-top-right-radius
| border-top-right-radius
|
-webkit-border-radius
| border-radius
|
-webkit-box-shadow
| box-shadow
|
-webkit-box-sizing
| box-sizing
|
-webkit-flex
| flex
|
-webkit-flex-basis
| flex-basis
|
-webkit-flex-direction
| flex-direction
|
-webkit-flex-flow
| flex-flow
|
-webkit-flex-grow
| flex-grow
|
-webkit-flex-shrink
| flex-shrink
|
-webkit-flex-wrap
| flex-wrap
|
-webkit-filter
| filter
|
-webkit-justify-content
| justify-content
|
-webkit-mask
| mask
|
-webkit-mask-box-image
| mask-border
|
-webkit-mask-box-image-outset
| mask-border-outset
|
-webkit-mask-box-image-repeat
| mask-border-repeat
|
-webkit-mask-box-image-slice
| mask-border-slice
|
-webkit-mask-box-image-source
| mask-border-source
|
-webkit-mask-box-image-width
| mask-border-width
|
-webkit-mask-clip
| mask-clip
|
-webkit-mask-composite
| mask-composite
|
-webkit-mask-image
| mask-image
|
-webkit-mask-origin
| mask-origin
|
-webkit-mask-position
| mask-position
|
-webkit-mask-repeat
| mask-repeat
|
-webkit-mask-size
| mask-size
|
-webkit-order
| order
|
-webkit-perspective
| perspective
|
-webkit-perspective-origin
| perspective-origin
|
-webkit-transform-origin
| transform-origin
|
-webkit-transform-style
| transform-style
|
-webkit-transform
| transform
|
-webkit-transition-delay
| transition-delay
|
-webkit-transition-duration
| transition-duration
|
-webkit-transition-property
| transition-property
|
-webkit-transition-timing-function
| transition-timing-function
|
-webkit-transition
| transition
|
3.4.2. Prefixed legacy name aliases
The following -webkit-
vendor prefixed properties must be supported as legacy name aliases of the corresponding unprefixed properties. If the
user agent does not ship the unprefixed equivalent, the -webkit-
prefixed property must
be treated as an alias of the user agent’s own vendor prefixed property.
-webkit- prefixed property alias
| (vendor prefixed) property |
---|---|
-webkit-text-size-adjust
| (-prefix-)text-size-adjust
|
Note: As soon as each property is unprefixable it can be defined as a legacy name alias.
3.4.3. Non-aliased vendor prefixed properties
Note: This section used to specify the -webkit-appearance property. This is now defined in CSS Basic User Interface Module.
3.4.4. Property mappings
The following -webkit-
vendor prefixed properties must be supported as mappings
to the corresponding unprefixed property:
-webkit- prefixed property
| unprefixed property |
---|---|
-webkit-box-align
| align-items
|
-webkit-box-flex
| flex-grow
|
-webkit-box-ordinal-group
| order
|
-webkit-box-orient
| flex-direction
|
-webkit-box-pack
| justify-content
|
These definitions of -webkit-box-*
are known to not be web compatible.
3.4.5. Keyword mappings
The following -webkit-
vendor prefixed keywords must be supported as mappings to
the corresponding unprefixed keyword:
-webkit- prefixed keyword
| unprefixed property keyword |
---|---|
-webkit-box
| flex
|
-webkit-flex
| flex
|
-webkit-inline-box
| inline-flex
|
-webkit-inline-flex
| inline-flex
|
These definitions of -webkit-box-*
are known to not be web compatible.
3.4.6. Text Fill and Stroking
3.4.6.1. Foreground Text Color: the -webkit-text-fill-color
property
Name: | -webkit-text-fill-color |
---|---|
Value: | <color> |
Initial: | currentcolor |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Computed value: | an RGBA color |
Canonical order: | per grammar |
Animation type: | by computed value type |
Media: | visual |
The -webkit-text-fill-color property defines the foreground fill color of an element’s text content.
-webkit-text-fill-color
will always determine the
foreground fill color of an element’s text.
.one{ color : blue; /* the following can be omitted because it’s the initial value: -webkit-text-fill-color: currentcolor; */ } .two{ color : red; -webkit-text-fill-color : blue; }
Elements with the one
or two
classes will have blue text.
3.4.6.2. Text Stroke Color: the -webkit-text-stroke-color
property
Name: | -webkit-text-stroke-color |
---|---|
Value: | <color> |
Initial: | currentcolor |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Computed value: | an RGBA color |
Canonical order: | per grammar |
Animation type: | by computed value type |
Media: | visual |
The -webkit-text-stroke-color property specifies a stroke color for an element’s text.
3.4.6.3. Text Stroke Thickness: the -webkit-text-stroke-width
property
Name: | -webkit-text-stroke-width |
---|---|
Value: | <line-width> |
Initial: | 0 |
Applies to: | all elements |
Inherited: | yes |
Percentages: | N/A |
Computed value: | absolute length |
Canonical order: | per grammar |
Animation type: | discrete |
Media: | visual |
The -webkit-text-stroke-width property specifies the width of the stroke drawn at the edge of each glyph of an element’s text. A zero value results in no stroke being painted. A negative value is invalid.
3.4.6.4. Text Stroke Shorthand: the -webkit-text-stroke
property
Name: | -webkit-text-stroke |
---|---|
Value: | <line-width> || <color> |
Initial: | See individual properties |
Applies to: | See individual properties |
Inherited: | yes |
Percentages: | N/A |
Computed value: | See individual properties |
Canonical order: | per grammar |
Animation type: | See individual properties |
Media: | visual |
The -webkit-text-stroke property is a shorthand property for the -webkit-text-stroke-width and -webkit-text-stroke-color properties, for setting the stroke width and stroke color of an element’s text.
-webkit-text-stroke
properties to achieve white text with a black stroked text
effect.
.stroked-text-longhand{ color : #fff; -webkit-text-stroke-color : #000; -webkit-text-stroke-width : 1 px ; } .stroked-text-shorthand{ -webkit-text-fill-color : #fff; -webkit-text-stroke : thin #000; }
The element
<p class="stroked-text-longhand">Serious typography</p>would be rendered as follows:
3.5. CSS Property values
3.5.1. Additional touch-action
values
This section augments the definition of touch-action
from [pointerevents2] to add the pinch-zoom
value.
Name: | touch-action |
---|---|
Value: | auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation |
Initial: | auto |
Applies to: | all elements except: non-replaced inline elements, table rows, row groups, table columns, and column groups. |
Inherited: | no |
Percentages: | N/A |
Computed value: | Same as specified value |
Canonical order: | per grammar |
Animation type: | not animatable |
Media: | visual |
When specified, the pinch-zoom
token enables multi-finger panning and zooming of the
page. For zooming to occur, all fingers must start on an element that has the pinch-zoom behavior
enabled (via one of the pinch-zoom
, manipulation
, or auto
values on itself or an ancestor).
touch-action: pan-y pinch-zoom
"
to avoid disabling zooming unnecessarily.manipulation
is an alias for "pan-x pan-y pinch-zoom
".
4. DOM Compatibility
4.1. The WebKitCSSMatrix interface
Note: WebKitCSSMatrix
is now defined by the DOM Geometry specification. [geometry-1].
4.2. window.orientation
API
partial interface Window {readonly attribute short orientation ;attribute EventHandler ; };
onorientationchange partial interface HTMLBodyElement {attribute EventHandler ; };
onorientationchange
When getting the orientation
attribute, the user agent must run
the following steps:
-
Let document be this’s relevant global object’s associated Document.
-
Return document’s current
window.orientation
angle.
Whenever the viewport is drawn at a different angle compared to the device’s natural orientation, the user agent must run the following steps:
-
Fire an event named
orientationchange
at theWindow
object of the active document.
User agents implementing the window.orientation
attribute and its associated orientationchange event must not expose them on non-Mobile
platforms.
orientationchange
event on the body
element, but other implementations do not, suggesting it’s not necessary for
compatibility with the web.4.2.1. window.orientation
angle
The possible integer values for the window.orientation
angle are: -90
, 0
, 90
, 180
. User agents must
support the -90
, 0
and 90
values and may optionally support 180
.
0
represents the natural orientation. -90
represents a
rotation 90 degrees clockwise from the natural orientation. 90
represents a rotation
90 degrees counterclockwise from the natural orientation. 180
represents a rotation
180 degrees from the natural orientation.
In order to determine the current window.orientation
angle, the user agent must run the following steps:
-
Let orientationAngle be the current orientation angle.
- If orientationAngle is less than 180, return orientationAngle.
- If orientationAngle is 180, and the user agent supports that value, return orientationAngle, else return 0.
- If orientationAngle is greater than 180, return orientationAngle - 360.
4.2.2. Event Handlers on Window
objects and body
elements
body
The following are the event handlers and their corresponding event handler event types that must be
supported on all Window
objects and
elements as attributes:body
event handler | event handler event type |
---|---|
| orientationchange
|
5. Cookie Access Heuristics
User agents are blocking third-party cookies by default while avoiding user-facing breakage by removing support for common web patterns, particularly login flows via third-party identity providers. Browsers should follow the established patterns in this specification in order to provide short-term cookie access to unbreak these flows.
5.1. Global Data
A site pair is a tuple consisting of a site third party site and a site first party site
The user agent holds a heuristic grants map which is a map of site pairs to moments. The moment represents the expiration timestamp of a cookie access grant for third party site on first party site.
5.2. Constants
The popup heuristic grant duration is an implementation-defined duration that represents the length of time after the popup heuristic is triggered that a user agent will store the corresponding popup heuristic grant in its heuristic grants map.
Note: Most implementations use 30 days as the popup heuristic grant duration.
The redirect heuristic grant duration is an implementation-defined duration that represents the length of time after the redirect heuristic is triggered that a user agent will store the corresponding redirect heuristic grant in its heuristic grants map.
Note: Most implementations use 15 minutes as the redirect heuristic grant duration.
5.3. Cookie Access Grant
To grant access for heuristics given a site site, site firstPartySite, moment currentWallTime, and duration duration, perform the following steps:
-
Let key be a site pair with third party site set to site and first party site set to firstPartySite.
-
Let expirationTime be duration after currentWallTime.
-
Set heuristic grants map[key] to expirationTime.
5.4. Cookie Access Monkey Patch
TODO: add monkey patch to network fetch cookie access that reads from heuristic grants map.
5.5. Popup Heuristic
Append the following steps to the [HTML]’s activation notification algorithm:
-
Run detect a popup heuristic given document.
To detect a popup heuristic given a Document document, perform the following steps:
-
Let browsingContext be document’s browsing context.
-
If browsingContext’s is popup is false, then return.
-
If browsingContext’s opener browsing context is null, then return.
-
If browsingContext’s opener origin at creation is null, then return.
-
Let firstPartySite be the result of running obtain a site given the browsingContext’s opener origin at creation.
-
Let navigable be document’s node navigable.
-
If navigable is null, then return.
-
Let topDocument be navigable’s top-level traversable’s active document.
-
Let origin be topDocument’s origin.
-
If origin is an opaque origin then return.
-
Let site be the result of running obtain a site given origin.
-
Let currentWallTime be topDocument’s relevant settings object’s current wall time.
-
Grant access for heuristics given site, firstPartySite, currentWallTime, and popup heuristic grant duration.
TODO: Consider whether to check for third-party iframe initiators.
5.6. Redirect Heuristic
Insert the following steps at the start of [HTML]’s load a document algorithm.
-
Run detect a redirect heuristic given navigationParams’s navigable.
To detect a redirect heuristic given a navigable navigable, perform the following steps:
-
Let topDocument be navigable’s top-level traversable’s active document.
-
Let firstPartyOrigin be topDocument’s origin.
-
If firstPartyOrigin is an opaque origin then return.
-
Let firstPartySite be the result of running obtain a site given firstPartyOrigin.
-
Let bounceTrackingRecord be navigable’s top-level traversable’s bounce tracking record.
-
Let currentWallTime be topDocument’s relevant settings object’s current wall time.
-
Let navigatedUrlsSet be bounceTrackingRecord’s bounce set.
-
Append bounceTrackingRecord’s initial host to navigatedUrlsSet.
-
For each bounceUrl in navigatedUrlsSet:
-
Let site be the result of running obtain a site given bounceUrl.
-
If bounceTrackingRecord’s user activation set does not contain site, continue.
-
Grant access for heuristics given site, firstPartySite, currentWallTime, and redirect heuristic grant duration.
-
6. The User-Agent String
The User-Agent
header field syntax is formally defined by [HTTP-SEMANTICS] and
provides SHOULD-level guidance on its value. This section serves as a descriptive record of the User-Agent
patterns found in the so-called major web browsers, but much of it will
apply to other browsers with a shared heritage (i.e., forks and embedders) as well as any user agent in the more general sense that send a User-Agent
header.
6.1. User-Agent Tokens
A User-Agent token is a string that represents an abstraction over a semantic unit in the User-Agent
string. This document formalizes a token as a string that
begins with an opening bracket "<" and ends with a closing ">" bracket, e.g., <version>
. A token may also contain other tokens.
A User-Agent constant is a string whose value does not change.
When a token’s value is made up from one or more tokens, and optionally constants, it is said to decompose to those tokens and constants.
6.1.1. User-Agent Token Reference
This is a non-exhaustive list of common User-Agent tokens.
Tokens | Description |
---|---|
<deviceCompat>
| Represents the form-factor of the device. Primarily this is "Mobile ", or
just the empty string, for Desktop or non-mobile devices. Some browsers have also sent token
values such as "Tablet ", "TV ", "Mobile VR ", etc., or
included build information as well.
|
<majorVersion>
| Represents the browser’s major version number. |
<minorVersion>
| Represents the browser’s non-major version numbers. |
<oscpu>
| Represents the device operating system and (optionally) CPU architecture. |
<platform>
| Represents the underlying device platform. |
6.2. Meta Structure
The User-Agent strings that follow share the common meta structure:
"Mozilla/5.0
(a
) b
"
Where a
is one or more tokens representing device information and b
is
one or more tokens representing browser information.
6.3. Chrome
6.3.1. Chrome User-Agent pattern
"Mozilla/5.0 (<unifiedPlatform>)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/<majorVersion>.0.0.0
<deviceCompat>Safari/537.36
"
Mozilla/5.0 (Macintosh;
Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/110.0.0.0 Safari/537.36
"
Mobile: "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/110.0.0.0 Mobile Safari/537.36
"
6.3.2. Chrome-specific tokens
Tokens | Description |
---|---|
<unifiedPlatform>
|
Per-platform constant that is one of the following values:
" |
6.4. Firefox
6.4.1. Firefox User-Agent pattern
"Mozilla/5.0 (<firefoxPlatform>; rv: <firefoxVersion>) Gecko/<geckoVersion>
Firefox/<firefoxVersion>
"
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
"
Mobile: "Mozilla/5.0 (Android 10; Mobile; rv:100.0) Gecko/100.0 Firefox/100.0
"
6.4.2. Firefox-specific tokens
<firefoxVersion>
decomposes to the following:
"<majorVersion>.0
"
In Firefox on desktop platforms (Windows, macOS, Linux, etc.), <geckoVersion>
is the frozen build
date "20100101
". In Firefox for Android, <geckoVersion>
is the
same value as <firefoxVersion>
.
<firefoxPlatform>
decomposes to the following:
On desktop platforms, "<platform>; <oscpu>
".
On Firefox for Android, "<platform>; <deviceCompat>
".
Tokens | Description |
---|---|
<deviceCompat>
| The string "Mobile ", without any leading or trailing spaces.
|
6.5. Safari
6.5.1. Safari User-Agent pattern
"Mozilla/5.0 (<safariPlatform>) AppleWebKit/605.1.15 (KHTML, like Gecko)
Version/<safariVersion><deviceCompat>Safari/<webkitVersion>
"
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15
(KHTML, like Gecko) Version/15.6 Safari/605.1.15
"
Mobile: "Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko)
Version/15.6 Mobile/15E148 Safari/604.1"
6.5.2. Safari-specific tokens
<safariVersion>
decomposes to the following:
"<majorVersion>.<minorVersion>
", where <minorVersion>
is a single digit.
<safariPlatform>
decomposes to the following:
On desktop and larger iPad form factors, the constant "Macintosh; Intel Mac OS X 10_15_7
".
On mobile platforms, including smaller iPad form factors
"<appleProduct>; CPU <mobileOSName> <iOSVersion> like Mac OS X
".
Tokens | Description |
---|---|
<appleProduct>
| Represents the marketing product name of the mobile device, which is one of
"iPad ", "iPhone ", and "iPod ".
|
<iOSVersion>
| Represents the iOS version number, delimited by an underscore ( for historical compatibility reasons). |
<mobileOSName>
| A constant that is one of two values: "OS " (for iPad-like devices) or
"iPhone OS " (non-iPad-like devices).
|
<webkitVersion>
| A constant that is one of two values: "605.1.15 " (for larger devices,
including non-mini iPad) or "604.1 " (for smaller mobile devices, including iPad
mini).
|
Acknowledgements
Thanks to Alan Cutter, Cameron McCormack, Chris Rebert, Chun-Min (Jeremy) Chen, Daniel Holbert, David Håsäther, Domenic Denicola, Eric Portis, hexalys, Jean-Yves Perrier, Jacob Rossi, Karl Dubost, Philip Jägenstedt, Rick Byers, Simon Pieters, Stanley Stuart, William Chen and Your Name Here for feedback and contributions to this standard.Thanks to Mounir Lamouri and Marcos Cáceres for defining the ScreenOrientation
interface. [screen-orientation]
Special thanks to Apple and the WebKit.org blog authors for providing initial descriptions of much of the content defined in this specification.
This standard is written by Mike Taylor (Google, miketaylr@google.com).
Intellectual property rights
Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0 International License. To the extent portions of it are incorporated into source code, such portions in the source code are licensed under the BSD 3-Clause License instead.
This is the Living Standard. Those interested in the patent-review version should view the Living Standard Review Draft.