Skip to content

Wrong polyfill for HTMLElement.prototype.remove throw error in edge case. #35387

Open
@EladHeller

Description

@EladHeller

Preconditions (*)

Magento/2.4 (Enterprise)

Steps to reproduce (*)

In javascript code, create an element without parent, then call remove function. For example:
document.createElement('div').remove()

  1. Browse to Magento 2.4 website.
  2. Open console
  3. Run document.createElement('div').remove()

Expected result (*)

Nothing happen.

Actual result (*)

An exception thrown:

Uncaught TypeError: Cannot read properties of null (reading 'removeChild')
    at remove (legacy-build.min.js:formatted:1759:22)
    at HTMLDivElement._methodized [as remove] (legacy-build.min.js:formatted:396:22)
    at <anonymous>:1:31

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions