Skip to content

Commit 052d475

Browse files
committed
fix: inline_fragment silently returning only leading whitespace when the input starts with whitespace
Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
1 parent f589e34 commit 052d475

File tree

11 files changed

+43
-5
lines changed

11 files changed

+43
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- `inline_fragment` silently returning only leading whitespace when the input starts with whitespace. [#692](https://github.com/Stranger6667/css-inline/issues/692)
8+
59
## [0.20.1] - 2026-03-26
610

711
### Changed

bindings/c/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- `inline_fragment` silently returning only leading whitespace when the input starts with whitespace. [#692](https://github.com/Stranger6667/css-inline/issues/692)
8+
59
## [0.20.1] - 2026-03-26
610

711
### Changed

bindings/java/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- `inlineFragment` silently returning only leading whitespace when the input starts with whitespace. [#692](https://github.com/Stranger6667/css-inline/issues/692)
8+
59
## [0.20.1] - 2026-03-26
610

711
### Changed

bindings/javascript/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- `inlineFragment` silently returning only leading whitespace when the input starts with whitespace. [#692](https://github.com/Stranger6667/css-inline/issues/692)
8+
59
## [0.20.1] - 2026-03-26
610

711
### Changed

bindings/javascript/__test__/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ h1 {
181181
color: blue;
182182
}`,
183183
),
184-
`<main>\n<h1 style="color: blue;">Hello</h1>\n<section>\n<p style="color: red;">who am i</p>\n</section>\n</main>`,
184+
`<main>\n<h1 style="color: blue;">Hello</h1>\n<section>\n<p style="color: red;">who am i</p>\n</section>\n</main>\n`,
185185
);
186186
});
187187

bindings/javascript/__test__/wasm.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,6 @@ h1 {
123123
color: blue;
124124
}`,
125125
),
126-
`<main>\n<h1 style="color: blue;">Hello</h1>\n<section>\n<p style="color: red;">who am i</p>\n</section>\n</main>`,
126+
`<main>\n<h1 style="color: blue;">Hello</h1>\n<section>\n<p style="color: red;">who am i</p>\n</section>\n</main>\n`,
127127
);
128128
});

bindings/php/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- `inline_fragment` silently returning only leading whitespace when the input starts with whitespace. [#692](https://github.com/Stranger6667/css-inline/issues/692)
8+
59
## [0.20.1] - 2026-03-26
610

711
### Changed

bindings/python/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- `inline_fragment` silently returning only leading whitespace when the input starts with whitespace. [#692](https://github.com/Stranger6667/css-inline/issues/692)
8+
59
## [0.20.1] - 2026-03-26
610

711
### Changed

bindings/ruby/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- `inline_fragment` silently returning only leading whitespace when the input starts with whitespace. [#692](https://github.com/Stranger6667/css-inline/issues/692)
8+
59
## [0.20.1] - 2026-03-26
610

711
### Changed

css-inline/src/html/document.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ impl Document {
284284

285285
/// Remove all the children from node and append them to `new_parent`.
286286
pub(super) fn reparent_children(&mut self, node: NodeId, new_parent: NodeId) {
287-
let mut next_child = self[node].first_child;
288-
while let Some(child) = next_child {
287+
// Re-read `first_child` each iteration: `append` calls `detach` internally, which clears
288+
// `child.next_sibling` and updates `node.first_child` to the former second child.
289+
while let Some(child) = self[node].first_child {
289290
self.append(new_parent, child);
290-
next_child = self[child].next_sibling;
291291
}
292292
}
293293

0 commit comments

Comments
 (0)