Galadriel's Mirror Example

A tiny JavaScript snippet to display the source of script tags
Created: 2017-01-12

I have found it to be very handy to be able to run and display the same JavaScript source without having to resort to copy-paste. Using the same source reduces the chance of error and is far less irritating to maintain.

"I know what it was that you saw, for that is also in my mind." - Galadriel

The script below has been displayed by Galadriel. Any element with the galadriel-mirror class is used as a "mirror" for the JavaScript tag found above it in the DOM tree.

And here is the div (id="output") displaying the result of the above JavaScript which, yes, is the same JavaScript:

See the project repo on

Viewing the source of this page (and search for "foobar") should clear up any confusion about what is happening here. :-)