I am trying to compile the properties prefixed by -apple-
and -khtml-
which are/were supported by WebKit and since which version they were eventually dropped or introduced.
What are the limitations imposed on them? For example can you find them in document.body.style
?
I guess only someone in the know like the reporter of this bug could provide us an accurate list. But I prefer asking here first this way everyone will benefit from it…
A good place to start your investigation is this revision.
Introduction
The problem is not quite as simple as you might think. It is easy enough to compare revisions of the "official" list of supported CSS properties and determine the revisions at which they were introduced or retired; however, support for the use of legacy prefixes is also determined by how they are handled by the CSS parser implementation. Thus, you should consult both the timeline and the full list of legacy prefixed properties below to determine how support is handled in a given WebKit revision.
Timeline of parser changes relating to legacy property support
- 5 May 2003 (r9101):
-apple
(and briefly-moz
!) will be normalized to-khtml
behind the scenes. - 30 Aug 2005 (r10397):
-webkit
added as an alternative to-khtml
. - 14 Jun 2006 (r13874): all
-webkit
properties will work with legacy prefixes (i.e.-apple
and-khtml
are normalized to-webkit
). All remaining legacy prefixes were updated to-webkit
in this revision. - 19 Feb 2008 (r30393): legacy prefix handling moved from
CSSGrammar.y
toCSSParser.cpp
. - 21 Jul 2010 (r63854): no legacy prefixes
are supported except for
-apple-dashboard-region
and-apple-line-clamp
. - 26 Jul 2010 (r64071): all
-webkit
properties work with legacy prefixes again. (Previous change reverted.) - 10 Apr 2012 (r113795): no legacy prefixes are supported unless specifically enabled.
List of legacy properties and revisions introduced/retired
The list below has been gathered from the commit history for the list of supported properties. The first number is the revision in which support for this property was added to the list; the second is the revision in which it was removed. No distinction is made between a property being renamed as opposed to being dropped outright.
The properties removed in r13874 lived on for some time under the -webkit
prefix, so the legacy prefixes might continue to work depending upon how they are handled by the parser. (See the timeline above for more details.)
- -apple-dashboard-region: r7588 to r9101
- -apple-line-clamp: r6391 to r9101
- -apple-text-size-adjust: r6805 to r9101
- -khtml-appearance: r9828 to r13874
- -khtml-binding: r5967 to r13874
- -khtml-border-horizontal-spacing: r5212 to r13874
- -khtml-border-vertical-spacing: r5212 to r13874
- -khtml-box-align: r4704 to r13874
- -khtml-box-direction: r4704 to r13874
- -khtml-box-flex: r4704 to r13874
- -khtml-box-flex-group: r4704 to r13874
- -khtml-box-flex-group-transition: r6758 to r6802
- -khtml-box-lines: r4704 to r13874
- -khtml-box-ordinal-group: r4704 to r13874
- -khtml-box-orient: r4704 to r13874
- -khtml-box-pack: r4704 to r13874
- -khtml-dashboard-region: r9101 to r13874
- -khtml-flow-mode: r4704 to r8041
- -khtml-font-size-delta: r8382 to r13874
- -khtml-horizontal-border-spacing: r5200 to r5212
- -khtml-line-break: r7763 to r13874
- -khtml-line-clamp: r9101 to r13874
- -khtml-margin-bottom-collapse: r7362 to r13874
- -khtml-margin-collapse: r7362 to r13874
- -khtml-margin-start: r7708 to r13874
- -khtml-margin-top-collapse: r7362 to r13874
- -khtml-marquee: r5301 to r13874
- -khtml-marquee-direction: r5301 to r13874
- -khtml-marquee-increment: r5301 to r13874
- -khtml-marquee-repetition: r5301 to r13874
- -khtml-marquee-speed: r5301 to r13874
- -khtml-marquee-style: r5301 to r13874
- -khtml-match-nearest-mail-blockquote-color: r8642 to r13874
- -khtml-nbsp-mode: r7763 to r13874
- -khtml-opacity: r4704 to r5340 *
- -khtml-padding-start: r7708 to r13874
- -khtml-rtl-ordering: r12027 to r13874
- -khtml-text-decorations-in-effect: r8466 to r13874
- -khtml-text-size-adjust: r9101 to r13874
- -khtml-user-drag: r6728 to r13874
- -khtml-user-modify: r5970 to r13874
- -khtml-user-select: r6728 to r13874
- -khtml-vertical-border-spacing: r5200 to r5212
* Although deprecated, -khtml-opacity
—and later -webkit-opacity
—was honoured by the parser right up until CSSProperties.in introduced support for aliases in r85212, and remains available as -webkit-opacity
to the latest revision.
A couple of -konq
prefixed properties were supported in very early revisions:
- -konq-flow-mode: r4 to r4704
- -konq-js-clip: r798 to r3695
The story today
Since r13874, the WebKit CSS parser simply normalized any legacy prefixes to -webkit
. Essentially, all -webkit
prefixed properties worked with the -apple
or -khtml
prefixes:
// If the prefix is -apple- or -khtml-, change it to -webkit-.
// This makes the string one character longer.
if (hasPrefix(buffer, length, "-apple-") || hasPrefix(buffer, length, "-khtml-")) {
memmove(buffer + 7, buffer + 6, length + 1 - 6);
memcpy(buffer, "-webkit", 7);
++length;
}
(This also explains why you cannot iterate through these properties in document.body.style
—those properties have been replaced by the parser with the corresponding -webkit
property.)
Peter Beverloo suggested that support for these properties should be removed or phased out For a brief time all legacy properties were disabled, with the exception of -apple-dashboard-region
and -apple-line-clamp
, but this was reverted mere days later because of myriad compatibility issues. In newer revisions, the legacy -apple
and -khtml
prefixes are disabled unless built with ENABLE(LEGACY_CSS_VENDOR_PREFIXES)
. When this feature flag is enabled, the parser permits the older behaviour outlined above.
if("WebkitAppearance" in document.body.style) {}
if("KhtmlAppearance" in document.body.style) {}
if("MozAppearance" in document.body.style) {}
来源:https://stackoverflow.com/questions/11705144/webkit-and-its-legacy-prefixes