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

Check the element type before calling createRadio from select() #6838

Merged
merged 1 commit into from
May 28, 2024

Conversation

lindapaiste
Copy link
Contributor

Only call createRadio from select() if the element is a valid radio parent (span or div)

Resolves #6836

Changes:
Adds a check (elt.tagName === 'DIV' || elt.tagName === 'SPAN') before calling createRadio. Other element types will just get a normal p5.Element.

I chose the elt.tagName === syntax because that is what is used in the lines above this. Note that createRadio uses an instanceof check (arg0.elt instanceof HTMLDivElement || arg0.elt instanceof HTMLSpanElement), but the result should be the same.

PR Checklist

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

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

Looks good! This looks like it could still potentially have some false positives, but fewer than before, and enables the use mentioned in the issue.

@limzykenneth limzykenneth merged commit 8e6ceff into processing:main May 28, 2024
2 checks passed
@limzykenneth
Copy link
Member

Thanks. I've merged this for now but we probably need to preview p5.DOM as part of 2.0 overall for something a bit more robust.

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.

p5.dom select('form') does not select <form> element
3 participants