Skip to content

Commit 296f358

Browse files
committed
[cssom] Support webkitFoo IDL attributes (in addition to WebkitFoo)
The camel-cased attributes rule already supports `WebkitFoo`, but WebKit and Blink also support a variant `webkitFoo` with lowercase `w`. Ref. whatwg/compat#21 Ref. whatwg/compat#20
1 parent f91f1b8 commit 296f358

1 file changed

Lines changed: 35 additions & 5 deletions

File tree

cssom/Overview.bs

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Former Editor: Glenn Adams, Cox Communications, Inc. http://www.cox.com, gle
1616
Former Editor: Anne van Kesteren, Opera Software ASA http://www.opera.com, annevk@annevk.nl, https://annevankesteren.nl/
1717
!Issues list: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&amp;component=CSSOM&amp;resolution=---">Bugzilla</a> (<a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=CSS&amp;component=CSSOM">file a bug</a>)
1818
Abstract: CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and of course CSS itself.
19-
Ignored Terms: EmptyString, mediaText, cssText, InvalidCharacterError, SecurityError, SyntaxError, IndexSizeError, HierarchyRequestError, InvalidStateError, InvalidModificationError, NoModificationAllowedError, CORS-same-origin, group of selectors, list of css page selectors, CSSCharsetRule, ProcessingInstruction, EventTarget, EventListener, Event, EventInit, Element, Range, Node, Text, style, CSSFontFaceRule
19+
Ignored Terms: EmptyString, mediaText, cssText, InvalidCharacterError, SecurityError, SyntaxError, IndexSizeError, HierarchyRequestError, InvalidStateError, InvalidModificationError, NoModificationAllowedError, CORS-same-origin, group of selectors, list of css page selectors, CSSCharsetRule, ProcessingInstruction, EventTarget, EventListener, Event, EventInit, Element, Range, Node, Text, style, CSSFontFaceRule, -webkit-transform
20+
Ignored Vars: m1, m2, camel_cased_attribute, webkit_cased_attribute, dashed_attribute
2021
</pre>
2122

2223
<pre class='anchors'>
@@ -104,6 +105,7 @@ spec:css-color-4; type:property; text:color
104105
spec:css-position-3; type:property; text:left
105106
spec:html5; type:element; text:style
106107
spec:css-namespaces-3; type:dfn; text:namespace prefix
108+
spec:dom-ls; type:interface; text:Document
107109
</pre>
108110

109111
<script src=https://resources.whatwg.org/file-bug.js async></script>
@@ -2408,6 +2410,30 @@ exceptions thrown must be re-thrown.
24082410

24092411
<div class=example>For example, for the 'font-size' property there would be a <code>fontSize</code> IDL attribute.</div>
24102412

2413+
For each CSS property <var>property</var> that is a <a>supported CSS property</a> and that begins
2414+
with the string <code>-webkit-</code>, the following partial interface applies where
2415+
<var>webkit-cased attribute</var> is obtained by running the <a>CSS property to IDL attribute</a>
2416+
algorithm for <var>property</var>, with the <i>lowercase first</i> flag set.
2417+
2418+
<pre class="idl extract">partial interface CSSStyleDeclaration {
2419+
[TreatNullAs=EmptyString] attribute DOMString _<var>webkit_cased_attribute</var>;
2420+
};</pre>
2421+
2422+
The <dfn attribute for=CSSStyleDeclaration><var>webkit-cased attribute</var></dfn> attribute, on
2423+
getting, must return the result of invoking {{CSSStyleDeclaration/getPropertyValue()}} with the
2424+
argument being the result of running the <a>IDL attribute to CSS property</a> algorithm for
2425+
<var>webkit-cased attribute</var>, with the <i>dash prefix</i> flag set.
2426+
2427+
Setting the <code attribute for=CSSStyleDeclaration><var>webkit-cased attribute</var></code>
2428+
attribute must invoke {{CSSStyleDeclaration/setProperty()}} with the first argument being the result
2429+
of running the <a>IDL attribute to CSS property</a> algorithm for <var>webkit-cased attribute</var>,
2430+
with the <i>dash prefix</i> flag set, as second argument the given value, and no third argument.
2431+
Any exceptions thrown must be re-thrown.
2432+
2433+
<div class=example>For example, if the user agent supports the '-webkit-transform' property, there
2434+
would be a <code>webkitTransform</code> IDL attribute. There would also be a
2435+
<code>WebkitTransform</code> IDL attribute because of the rules for camel-cased attributes.</div>
2436+
24112437
For each CSS property <var>property</var> that is a <a>supported CSS property</a>,
24122438
except for properties that have no "<code>-</code>" (U+002D) in the property name,
24132439
the following partial interface applies where <var>dashed attribute</var> is <var>property</var>.
@@ -2431,14 +2457,16 @@ exceptions thrown must be re-thrown.
24312457
<pre><var>element</var>.style['font-size'];</pre>
24322458
</div>
24332459

2434-
The <dfn>CSS property to IDL attribute</dfn> algorithm for <var>property</var> is as
2435-
follows:
2460+
The <dfn>CSS property to IDL attribute</dfn> algorithm for <var>property</var>, optionally with a
2461+
<i>lowercase first</i> flag set, is as follows:
24362462

24372463
<ol>
24382464
<li>Let <var>output</var> be the empty string.
24392465

24402466
<li>Let <var>uppercase next</var> be unset.
24412467

2468+
<li>If the <i>lowercase first</i> flag is set, remove the first character from <var>property</var>.
2469+
24422470
<li>For each character <var>c</var> in <var>property</var>:
24432471

24442472
<ol>
@@ -2453,12 +2481,14 @@ follows:
24532481
<li>Return <var>output</var>.
24542482
</ol>
24552483

2456-
The <dfn>IDL attribute to CSS property</dfn> algorithm for <var>attribute</var> is as
2457-
follows:
2484+
The <dfn>IDL attribute to CSS property</dfn> algorithm for <var>attribute</var>, optionally with a
2485+
<i>dash prefix</i> flag set, is as follows:
24582486

24592487
<ol>
24602488
<li>Let <var>output</var> be the empty string.
24612489

2490+
<li>If the <i>dash first</i> flag is set, append "<code>-</code>" (U+002D) to <var>output</var>.
2491+
24622492
<li>For each character <var>c</var> in <var>attribute</var>:
24632493

24642494
<ol>

0 commit comments

Comments
 (0)