@@ -100,7 +100,7 @@ following members:
100100:: The initial value of this custom property.
101101
102102The {{registerProperty()}} function {#the-registerproperty-function}
103- --------------------------------------------------------------------------------------------------
103+ --------------------------------------------------------------------
104104
105105The <dfn method for=CSS>registerProperty(PropertyDescriptor descriptor)</dfn> method
106106registers a custom property according to the configuration options provided in
@@ -458,7 +458,52 @@ but be automatically [=invalid at computed-value time=].
458458As ''@supports'' tests parse behavior,
459459it thus also accepts all values as valid regardless of the registered syntax.
460460
461+ Dependency cycles via relative units
462+ ------------------------------------
463+
464+ Registered custom properties follow the same rules for dependency cycle
465+ resolution as unregistered custom properties, with the following additional
466+ constraints:
467+
468+ For any registered custom property with a <<length>> or <<length-percentage>> syntax
469+ component:
470+
471+ * If the property contains any of the following units:
472+ ''em'' , ''ex'' , ''cap'' , ''ch'' , ''ic'' , ''lh'' ;
473+ then add an edge between the property and the ''font-size'' of the current
474+ element.
475+ * If the property contains the ''lh'' unit,
476+ add an edge between the property and the ''line-height'' of the current
477+ element.
478+ * If the property contains any of the following units: ''rem'' , ''rlh'' ;
479+ then add an edge between the property
480+ and the 'font-size' ' of the root element.
481+ * If the property contains the 'rlh' unit, add an edge between the property
482+ and the 'line-height' ' of the root element.
461483
484+ <div class='example'>
485+ For example, given this registration:
486+
487+ <pre class='lang-javascript'>
488+ CSS.registerProperty({
489+ name: "--my-font-size",
490+ syntax: "<length>",
491+ initialValue: "0px",
492+ inherits: false
493+ });
494+ </pre>
495+
496+ the following will produce a dependency cycle:
497+
498+ <pre class='lang-css'>
499+ div {
500+ --my-font-size: 10em;
501+ font-size: var(--my-font-size);
502+ }
503+ </pre>
504+
505+ and ''font-size'' will behave as if the value ''unset'' was specified.
506+ </div>
462507
463508Behavior of Custom Properties {#behavior-of-custom-properties}
464509==============================================================
0 commit comments