Prototype selectors $, $$…etc return extended object Element. But some times I need simple, not extended, HTMLElement object. How can I get it using Prototype selectors?
Prototype selectors $ , $$ …etc return extended object Element . But some times
Share
You can’t. Prototype.js modifies
Element‘s prototype, whose methods are inherit byHTMLElement.$is equivalent todocument.getElementById, and returns a plain element, ornull.$$is similar todocument.querySelectorAll, but returns anArrayinstead of aNodeList.The easy way to proof it, run the following code on a page where Prototype.js is used:
Instead of just
prototype, this prints a whole list, similar to: