Files
sousa-gecko/testing/web-platform/tests/css/css-values/inherit-function-parsing.html
T
Anders Hartvoll Ruud 7d53c88c94 Bug 1994658 [wpt PR 55474] - Implement the inherit() function behind a flag, a=testonly
Automatic update from web-platform-tests
Implement the inherit() function behind a flag

The inherit() function works like var(), except that it substitutes
to the specified computed custom property value on the parent element
rather than the current element. This can be useful to modify some
property coming from the ancestry "in-place", e.g.:

  div {
    /* Twice the flair from this point in the ancestor chain. */
    --flair: calc(inherit(--flair) * 2);
  }

Note: Using the inherit() function probably means the child-has-
explicit-inheritance flag must be set on the parent style.
This CL does not do this, so there may be an invalidation bug.

Bug: 452071846
Change-Id: I1f9b78ef36b0cb6842fc2ed854238ddd5c21ad66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7044487
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1530721}

--

wpt-commits: 166457119f073eb7cf998c07dc359a25b26879c4
wpt-pr: 55474
2025-10-24 08:57:07 +00:00

18 lines
758 B
HTML

<!DOCTYPE html>
<title>CSS Values: The inherit() function (parsing)</title>
<link rel="help" href="https://drafts.csswg.org/css-values-5/#inherit-notation">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script>
// 'left' chosen arbitrarily:
test_valid_value('left', 'inherit(--x)');
test_valid_value('left', 'calc(inherit(--x) + 1px)');
test_valid_value('left', 'inherit(--x,)');
test_valid_value('left', 'inherit(--x, )');
test_valid_value('left', 'inherit(--x , )');
test_valid_value('left', 'inherit(--x, foo)');
test_invalid_value('left', 'inherit(!!, foo)');
test_invalid_value('left', 'inherit(, foo)');
</script>