Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Ensure insertBefore throws an error when called with incorrect number of arguments #4325

Closed

Conversation

manoharsiriki
Copy link

Details

Does this pull request introduce a breaking change?

  • ๐Ÿ˜ฎโ€๐Ÿ’จ No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • ๐Ÿ”ฌ Yes, it does include an observable change.

GUS work item

@manoharsiriki manoharsiriki requested a review from a team as a code owner June 25, 2024 10:53
Copy link

Thanks for the contribution! Before we can merge this, we need @manoharsiriki to sign the Salesforce Inc. Contributor License Agreement.

@@ -66,6 +66,9 @@ function monkeyPatchDomAPIs() {
return callNodeSlot(appendedNode, ConnectingSlot);
},
insertBefore(newChild, referenceNode) {
if (arguments.length < 2) {
throw new TypeError("Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution @manoharsiriki ! Unfortunately we cannot merge this PR as-is. The problem is that our existing users may be relying on the behavior where insertBefore(foo) does not throw an error and silently "works" the same as insertBefore(foo, undefined).

Could you instead please add a logWarnOnce here to tell the user that they are using an unsupported API? And please add a test to assert that the warning is called, using toLogWarningDev?

Copy link
Contributor

@nolanlawson nolanlawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

@manoharsiriki manoharsiriki deleted the fix-insertBefore-error branch July 5, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants