MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / wrapElement

Function wrapElement

libraries/p5.dom.js:175–194  ·  view source on GitHub ↗

* Helper function for getElement and getElements.

(elt)

Source from the content-addressed store, hash-verified

173 * Helper function for getElement and getElements.
174 */
175 function wrapElement(elt) {
176 if(elt.tagName === "INPUT" && elt.type === "checkbox") {
177 var converted = new p5.Element(elt);
178 converted.checked = function(){
179 if (arguments.length === 0){
180 return this.elt.checked;
181 } else if(arguments[0]) {
182 this.elt.checked = true;
183 } else {
184 this.elt.checked = false;
185 }
186 return this;
187 };
188 return converted;
189 } else if (elt.tagName === "VIDEO" || elt.tagName === "AUDIO") {
190 return new p5.MediaElement(elt);
191 } else {
192 return new p5.Element(elt);
193 }
194 }
195
196 /**
197 * Removes all elements created by p5, except any canvas / graphics

Callers 1

p5.dom.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected