@@ -1419,28 +1419,40 @@ appear as computed values (i.e. as a value stored on computed
1419
1419
Computed {{CSSUnparsedValue}} objects {#computed-unparsedvalue-objects}
1420
1420
-----------------------------------------------------------------------------
1421
1421
1422
- Custom property references are resolved as part of style computation. Accordingly,
1423
- computed {{CSSUnparsedValue}} objects will not contain {{CSSVariableReferenceValue}} objects.
1424
- As a result, only a single {{DOMString}} will appear in the sequence contained by
1425
- computed {{CSSUnparsedValue}} objects.
1426
-
1427
- Furthermore, values that at specified value time contained custom property references
1428
- are renormalized after computation.
1422
+ A property with a specified {{CSSUnparsedValue}} value will not
1423
+ compute to a {{CSSUnparsedValue}} . Instead, after custom property references
1424
+ are resolved, the {{CSSStyleValue}} subclass appropriate to the property will be
1425
+ used.
1429
1426
1430
1427
<div class='example'>
1428
+ For example, a style rule containing:
1431
1429
1432
- Consider an element "e" with an inline style that specifies a width of <code> var(--baz)</code> .
1430
+ <pre class='style'>
1431
+ width: calc(var(--foo) + 10%);
1432
+ </pre>
1433
1433
1434
- Assuming that the custom property --baz contains the value "42px", running the following code:
1434
+ Will represent a specified width as an {{CSSUnparsedValue}} , but if this value
1435
+ is the winning value during computation for a given element then that element's
1436
+ computed width will be represented by a {{CSSLengthValue}} object (assuming
1437
+ that --foo resolves to a valid substitution).
1438
+ </div>
1435
1439
1436
- <pre class='lang-javascript'>
1437
- var a = e.styleMap.get('width' );
1438
- var b = getComputedStyleMap(e).get('width' );
1439
- </pre>
1440
+ Often there will be no {{CSSStyleValue}} subclass appropriate - for example when a custom property
1441
+ contains a reference to another custom property. In these cases, a {{CSSStyleValue}}
1442
+ is used directly to represent a valud of unknown type.
1440
1443
1441
- Will result in "a" containing a {{CSSUnparsedValue}} with a single {{CSSVariableReferenceValue}}
1442
- in its sequence, and "b" containing a {{CSSSimpleLength}} representing 42px.
1444
+ <div class='example'>
1445
+
1446
+ For example, a style rule containing:
1447
+
1448
+ <pre class='style'>
1449
+ --foo: var(--bar) black;
1450
+ </pre>
1443
1451
1452
+ Will represent a specified value for --foo as a {{CSSUnparsedValue}} , and if
1453
+ this value is the winning declaration for --foo during computation for a given
1454
+ element, then that element's will have a computed value for --foo that is
1455
+ represented by a {{CSSStyleValue}} .
1444
1456
</div>
1445
1457
1446
1458
Computed {{CSSKeywordValue}} objects {#computed-keywordvalue-objects}
0 commit comments