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