magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

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

Open EladHeller opened 2 years ago

EladHeller commented 2 years ago

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.

m2-assistant[bot] commented 2 years ago

Hi @EladHeller. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 2 years ago

Hi @EladHeller! :wave: Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

m2-assistant[bot] commented 1 year ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 1 year ago

Hi @EladHeller , Thank you for reporting and collaboration. Verified the issue on Magento 2.4-develop instance and the issue is reproducible. Hence updating the description and confirming the issue. Steps performed:

  1. Browse to Magento 2.4 website.
  2. Open console
  3. Run document.createElement('div').remove() image
github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-7666 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

kanidaya commented 2 months ago

i am facing same issue i can't able to click and save admin store configuration can you please share quick fix for this

EladHeller commented 2 months ago

@kanidaya I proposed a solution in #35388, but I haven't had the time to follow up and get it merged.

kanidaya commented 2 months ago

@EladHeller this change already there in 2.4.7-p2 but still i am getting below while admin configuration

legacy-build.min.js:12 Uncaught TypeError: ah.dispatchEvent is not a function at r (legacy-build.min.js:12:32795) at D (legacy-build.min.js:12:32626) at HTMLDocument._methodized [as fire] (legacy-build.min.js:1:6441) at d (legacy-build.min.js:12:34954) at legacy-build.min.js:12:34408Understand this error legacy-build.min.js:12 Uncaught TypeError: $(...).removeClassName is not a function at Object.applyCollapse (legacy-build.min.js:12:147567) at Object.toggleCollapse (legacy-build.min.js:12:148155) at HTMLAnchorElement.eventListener9tmbiETHAp (6c8471f696931ebcf4ba741ab4a76321ac03408b6b79a9af71a9e0f07aa8885b/:475:41) at element.onclick (6c8471f696931ebcf4ba741ab4a76321ac03408b6b79a9af71a9e0f07aa8885b/:486:52)

kanidaya commented 2 months ago

created issue https://github.com/magento/magento2/issues/39066