Skip to content

Commit b32c429

Browse files
author
Simon Pieters
committed
[cssom] Expose 'float' and 'font-size' etc IDL attributes on CSSStyleDeclaration. http://www.w3.org/mid/4F3C1122.6020306@mit.edu
1 parent ed57496 commit b32c429

2 files changed

Lines changed: 64 additions & 16 deletions

File tree

cssom/Overview.html

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,26 +2264,50 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The
22642264
<code title="">float</code> as first argument, as second argument the given value, and no third argument.
22652265
Any exceptions thrown must be re-thrown.
22662266

2267-
<p>For each CSS property <var title="">property</var> that the user agent supports, except for
2268-
the 'float' property, the following partial interface applies where <var title="">attribute</var>
2267+
<p>For each CSS property <var title="">property</var> that the user agent supports,
2268+
the following partial interface applies where <var title="">camel-cased attribute</var>
22692269
is obtained by running the <a href="#css-property-to-idl-attribute">CSS property to IDL attribute</a> algorithm for
22702270
<var>property</var>.</p>
22712271

22722272
<pre class="idl">partial interface <a href="#cssstyledeclaration">CSSStyleDeclaration</a> {
2273-
attribute DOMString _<var title="dom-CSSStyleDeclaration-attribute"><a href="#dom-cssstyledeclaration-attribute">attribute</a></var>;
2273+
attribute DOMString _<a href="#dom-cssstyledeclaration-camel-cased-attribute" title="dom-CSSStyleDeclaration-camel-cased-attribute"><var title="">camel-cased attribute</var></a>;
22742274
};</pre>
22752275

2276-
<p>The <dfn id="dom-cssstyledeclaration-attribute" title="dom-CSSStyleDeclaration-attribute"><code><var title="">attribute</var></code></dfn> attribute, on getting, must return the result of invoking
2277-
<code title="dom-CSSStyleDeclaration-getPropertyValue"><a href="#dom-cssstyledeclaration-getpropertyvalue">getPropertyValue()</a></code> with the
2276+
<p>The <dfn id="dom-cssstyledeclaration-camel-cased-attribute" title="dom-CSSStyleDeclaration-camel-cased-attribute"><code><var title="">camel-cased attribute</var></code></dfn> attribute, on getting, must return the
2277+
result of invoking <code title="dom-CSSStyleDeclaration-getPropertyValue"><a href="#dom-cssstyledeclaration-getpropertyvalue">getPropertyValue()</a></code> with the
22782278
argument being the result of running the <a href="#idl-attribute-to-css-property">IDL attribute to CSS property</a>
2279-
algorithm for <var>attribute</var>.</p>
2279+
algorithm for <var title="">camel-cased attribute</var>.</p>
22802280

2281-
<p>Setting the <code title="dom-CSSStyleDeclaration-attribute"><a href="#dom-cssstyledeclaration-attribute"><var>attribute</var></a></code> attribute must invoke
2281+
<p>Setting the <code title="dom-CSSStyleDeclaration-camel-cased-attribute"><a href="#dom-cssstyledeclaration-camel-cased-attribute"><var title="">camel-cased attribute</var></a></code> attribute must invoke
22822282
<code title="dom-CSSStyleDeclaration-setProperty"><a href="#dom-cssstyledeclaration-setproperty">setProperty()</a></code> with the
22832283
first argument being the result of running the <a href="#idl-attribute-to-css-property">IDL attribute to CSS property</a>
2284-
algorithm for <var>attribute</var>, as second argument the given value, and no third argument. Any
2284+
algorithm for <var title="">camel-cased attribute</var>, as second argument the given value, and no third argument. Any
22852285
exceptions thrown must be re-thrown.</p>
22862286

2287+
<p class="example">For example, for the 'font-size' property there would be a <code title="">fontSize</code> IDL attribute.
2288+
2289+
<p>For each CSS property <var title="">property</var> that the user agent supports, except for properties that have no "<code title="">-</code>" (U+002D) in the
2290+
property name, user agents must act as if there was a WebIDL <a class="external" href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-regular-attribute">regular attribute</a> member as part of the
2291+
<code><a href="#cssstyledeclaration">CSSStyleDeclaration</a></code> interface with the type being <code title="">DOMString</code> and the <a class="external" href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-identifier">identifier</a> being
2292+
<var title="">property</var>, and let <var title="">dashed attribute</var> be <var title="">property</var>.
2293+
2294+
<p>The <dfn id="dom-cssstyledeclaration-dashed-attribute" title="dom-CSSStyleDeclaration-dashed-attribute"><code><var title="">dashed attribute</var></code></dfn> attribute, on getting, must return the
2295+
result of invoking <code title="dom-CSSStyleDeclaration-getPropertyValue"><a href="#dom-cssstyledeclaration-getpropertyvalue">getPropertyValue()</a></code> with the
2296+
argument being <var title="">dashed attribute</var>.</p>
2297+
2298+
<p>Setting the <code title="dom-CSSStyleDeclaration-dashed-attribute"><a href="#dom-cssstyledeclaration-dashed-attribute"><var title="">dashed attribute</var></a></code> attribute must invoke
2299+
<code title="dom-CSSStyleDeclaration-setProperty"><a href="#dom-cssstyledeclaration-setproperty">setProperty()</a></code> with the
2300+
first argument being <var title="">dashed attribute</var>, as second argument the given value, and no third argument. Any
2301+
exceptions thrown must be re-thrown.</p>
2302+
2303+
<div class="example">
2304+
<p>For example, for the 'font-size' property there would be a <code title="">font-size</code> IDL attribute. In JavaScript, the property can be accessed as
2305+
follows, assuming <var title="">element</var> is an <a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#html-elements" title="HTML elements">HTML element</a>:
2306+
<pre><var title="">element</var>.style['font-size'];</pre>
2307+
</div>
2308+
2309+
<p class="note">WebIDL does not allow dashes in identifiers in its syntax.
2310+
22872311
<p>The <dfn id="css-property-to-idl-attribute">CSS property to IDL attribute</dfn> algorithm for <var title="">property</var> is as
22882312
follows:</p>
22892313

cssom/Overview.src.html

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,26 +2195,50 @@ <h4>The <code title>CSSStyleDeclaration</code> Interface</h4>
21952195
<code title>float</code> as first argument, as second argument the given value, and no third argument.
21962196
Any exceptions thrown must be re-thrown.
21972197

2198-
<p>For each CSS property <var title>property</var> that the user agent supports, except for
2199-
the 'float' property, the following partial interface applies where <var title>attribute</var>
2198+
<p>For each CSS property <var title>property</var> that the user agent supports,
2199+
the following partial interface applies where <var title>camel-cased attribute</var>
22002200
is obtained by running the <span>CSS property to IDL attribute</span> algorithm for
22012201
<var>property</var>.</p>
22022202

22032203
<pre class=idl>partial interface <span>CSSStyleDeclaration</span> {
2204-
attribute DOMString _<var title=dom-CSSStyleDeclaration-attribute>attribute</var>;
2204+
attribute DOMString _<span title=dom-CSSStyleDeclaration-camel-cased-attribute><var title>camel-cased attribute</var></span>;
22052205
};</pre>
22062206

2207-
<p>The <dfn title=dom-CSSStyleDeclaration-attribute><code><var title>attribute</var></code></dfn> attribute, on getting, must return the result of invoking
2208-
<code title=dom-CSSStyleDeclaration-getPropertyValue>getPropertyValue()</code> with the
2207+
<p>The <dfn title=dom-CSSStyleDeclaration-camel-cased-attribute><code><var title>camel-cased attribute</var></code></dfn> attribute, on getting, must return the
2208+
result of invoking <code title=dom-CSSStyleDeclaration-getPropertyValue>getPropertyValue()</code> with the
22092209
argument being the result of running the <span>IDL attribute to CSS property</span>
2210-
algorithm for <var>attribute</var>.</p>
2210+
algorithm for <var title>camel-cased attribute</var>.</p>
22112211

2212-
<p>Setting the <code title=dom-CSSStyleDeclaration-attribute><var>attribute</var></code> attribute must invoke
2212+
<p>Setting the <code title=dom-CSSStyleDeclaration-camel-cased-attribute><var title>camel-cased attribute</var></code> attribute must invoke
22132213
<code title=dom-CSSStyleDeclaration-setProperty>setProperty()</code> with the
22142214
first argument being the result of running the <span>IDL attribute to CSS property</span>
2215-
algorithm for <var>attribute</var>, as second argument the given value, and no third argument. Any
2215+
algorithm for <var title>camel-cased attribute</var>, as second argument the given value, and no third argument. Any
22162216
exceptions thrown must be re-thrown.</p>
22172217

2218+
<p class=example>For example, for the 'font-size' property there would be a <code title>fontSize</code> IDL attribute.
2219+
2220+
<p>For each CSS property <var title>property</var> that the user agent supports, except for properties that have no "<code title>-</code>" (U+002D) in the
2221+
property name, user agents must act as if there was a WebIDL <span data-anolis-spec=webidl>regular attribute</span> member as part of the
2222+
<code>CSSStyleDeclaration</code> interface with the type being <code title>DOMString</code> and the <span data-anolis-spec=webidl>identifier</span> being
2223+
<var title>property</var>, and let <var title>dashed attribute</var> be <var title>property</var>.
2224+
2225+
<p>The <dfn title=dom-CSSStyleDeclaration-dashed-attribute><code><var title>dashed attribute</var></code></dfn> attribute, on getting, must return the
2226+
result of invoking <code title=dom-CSSStyleDeclaration-getPropertyValue>getPropertyValue()</code> with the
2227+
argument being <var title>dashed attribute</var>.</p>
2228+
2229+
<p>Setting the <code title=dom-CSSStyleDeclaration-dashed-attribute><var title>dashed attribute</var></code> attribute must invoke
2230+
<code title=dom-CSSStyleDeclaration-setProperty>setProperty()</code> with the
2231+
first argument being <var title>dashed attribute</var>, as second argument the given value, and no third argument. Any
2232+
exceptions thrown must be re-thrown.</p>
2233+
2234+
<div class=example>
2235+
<p>For example, for the 'font-size' property there would be a <code title>font-size</code> IDL attribute. In JavaScript, the property can be accessed as
2236+
follows, assuming <var title>element</var> is an <span data-anolis-spec=html title="HTML elements">HTML element</span>:
2237+
<pre><var title>element</var>.style['font-size'];</pre>
2238+
</div>
2239+
2240+
<p class=note>WebIDL does not allow dashes in identifiers in its syntax.
2241+
22182242
<p>The <dfn>CSS property to IDL attribute</dfn> algorithm for <var title>property</var> is as
22192243
follows:</p>
22202244

0 commit comments

Comments
 (0)