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

referenceNode argument to Node.insertBefore should be nullable #62

Open
zopsicle opened this issue Mar 23, 2025 · 1 comment
Open

referenceNode argument to Node.insertBefore should be nullable #62

zopsicle opened this issue Mar 23, 2025 · 1 comment

Comments

@zopsicle
Copy link

zopsicle commented Mar 23, 2025

https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore reads:

referenceNode The node before which newNode is inserted. If this is null, then newNode is inserted at the end of node's child nodes.

but Node.insertBefore requires a reference node to be provided.

Possible workaround:

case referenceNode of
  Just r -> Node.insertBefore newNode r this
  Nothing -> Node.appendChild newNode this
@garyb
Copy link
Member

garyb commented Mar 23, 2025

Yeah I think that workaround is preferable to matching the API exactly in this case, explicit is better than implicit.

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

No branches or pull requests

2 participants