Skip to content

CSSRenderer: Ensure element exists when execute remove.#31905

Merged
Mugen87 merged 2 commits into
mrdoob:devfrom
xiaoliyooo:dev
Sep 16, 2025
Merged

CSSRenderer: Ensure element exists when execute remove.#31905
Mugen87 merged 2 commits into
mrdoob:devfrom
xiaoliyooo:dev

Conversation

@xiaoliyooo

Copy link
Copy Markdown
Contributor

Related issue: #29660

I found that fixing this issue caused an edge issue where deleting a 2D object when its children contain non-2D objects would cause an error because its children did not have an element attribute, I think this should be added, although I'm not sure if this is the correct hierarchy.

@Mugen87

Mugen87 commented Sep 15, 2025

Copy link
Copy Markdown
Collaborator

Can you also update CSS3Renderer in the same way?

this.addEventListener( 'removed', function () {
this.traverse( function ( object ) {
if (
object.element instanceof object.element.ownerDocument.defaultView.Element &&
object.element.parentNode !== null
) {
object.element.remove();
}
} );
} );
}

This change makes indeed the renderer more robust.

@Mugen87 Mugen87 added this to the r181 milestone Sep 15, 2025
@xiaoliyooo

Copy link
Copy Markdown
Contributor Author

Can you also update CSS3Renderer in the same way?你也可以用同样的方式更新 CSS3Renderer 吗?

this.addEventListener( 'removed', function () {
this.traverse( function ( object ) {
if (
object.element instanceof object.element.ownerDocument.defaultView.Element &&
object.element.parentNode !== null
) {
object.element.remove();
}
} );
} );
}

This change makes indeed the renderer more robust.这一变化确实使渲染器更加健壮。

Okay, I'll add it on later!

@xiaoliyooo

Copy link
Copy Markdown
Contributor Author

Can you also update CSS3Renderer in the same way?

this.addEventListener( 'removed', function () {
this.traverse( function ( object ) {
if (
object.element instanceof object.element.ownerDocument.defaultView.Element &&
object.element.parentNode !== null
) {
object.element.remove();
}
} );
} );
}

This change makes indeed the renderer more robust.

Added😀!

@Mugen87 Mugen87 merged commit f25b5a6 into mrdoob:dev Sep 16, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants