Skip to content

Conversation

@ahayzen-kdab
Copy link

eg

<div>
    <blockquote></blockquote>
    <tag></tag>
    <blockquote></blockquote>
</div>

Needs to become

<blockquote></blockquote>
<div>
    <tag></tag>
</div>
<blockquote></blockquote>

Before it became

<blockquote></blockquote>

This solves the following crash
ValueError: Cannot replace one element with another when the element to be replaced is not part of a tree.

Related #141

(Description)

Ticket URL: #141


Testing

  • CI passes
  • If necessary, tests are added for new or fixed behaviour
  • These changes do not reduce test coverage

Documentation.

  • This PR adds or updates documentation
  • Documentation changes are not necessary because:

eg

```html
<div>
    <blockquote></blockquote>
    <tag></tag>
    <blockquote></blockquote>
</div>
```

Needs to become
```html
<blockquote></blockquote>
<div>
    <tag></tag>
</div>
<blockquote></blockquote>
```

Before it became
```html
<blockquote></blockquote>
```

This solves the following crash
ValueError: Cannot replace one element with another when the element to be replaced is not part of a tree.

Related wagtail#141
@nickmoreton nickmoreton added Investigate further waiting for after 0.3.1 release A better time to consider this is after the package is next released, planned 0.3.1 help wanted Extra attention is needed labels May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed Investigate further waiting for after 0.3.1 release A better time to consider this is after the package is next released, planned 0.3.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

replace_with fails with Cannot replace one element with another when the element to be replaced is not part of a tree error

2 participants