Files
sousa-gecko/testing/web-platform/tests/css/cssom/all-initial-csstext.html
T
Peng Zhou 588abf9c17 Bug 2019607 [wpt PR 58071] - CSSOM: Preserve longhand ordering when expanding all property, a=testonly
Automatic update from web-platform-tests
CSSOM: Preserve longhand ordering when expanding all property

During cssText serialization, the 'all' property may be expanded into
longhands. In that path, longhands declared after all can be emitted out
of order and separated from related declarations, which hurts shorthand
reconstruction and cssText round-trip stability.

Track longhands that appear after 'all', and keep them in the
property-set range so they are emitted together at the end. Update index
mapping and enumeration logic in `CSSPropertyValueSetForSerializer` for
the expanded 'all' path.

Bug: 41416124
Change-Id: Ib752bf767d5185c3e81dabc53868db14d5e51909
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7608759
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Peng Zhou <zhoupeng.1996@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#1590773}

--

wpt-commits: 8fd7fb6cf8092532494bfa3fb0b130cade2ef713
wpt-pr: 58071
2026-03-04 09:08:10 +00:00

30 lines
881 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSSOM: cssText round-trip with `all: initial`</title>
<link rel="author" title="Peng Zhou" href="mailto:zhoupeng.1996@bytedance.com">
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-csstext">
<link rel="help" href="https://drafts.csswg.org/cssom/#css-declaration-blocks">
<link rel="match" href="all-initial-csstext-ref.html">
<style>
.test {
all: initial;
display: block;
border: 1px solid #ccc;
padding: 10px;
}
</style>
</head>
<body>
<div class="test">First Element</div>
<br/>
<div class="test-clone">Clone element</div>
<script>
const styleSheet = document.styleSheets[0];
const cssText = styleSheet.cssRules[0].style.cssText;
styleSheet.insertRule('.test-clone { ' + cssText + ' }', 1);
</script>
</body>
</html>