processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.13k stars 3.23k forks source link

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

Closed lindapaiste closed 1 month ago

lindapaiste commented 4 months ago

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

limzykenneth commented 1 month ago

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.