Skip to content

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
@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