Skip to main content
Commonmark migration
Source Link

##Javascript var button = document.createElement('button'); button.addEventListener('click', document.createElement); window.onerror = setTimeout.bind(window, button.click); button.click();

Javascript

<script>
    var button = document.createElement('button');
    button.addEventListener('click', document.createElement);
    window.onerror = setTimeout.bind(window, button.click);
    button.click();
</script>

Explanation: document.createElement() expects a parameter, so clicking the button causes an error to be thrown. The window catches the error and dispatches another click to the button. I don't think this meets the definition of recursion provided since the browser's event loop is invoking the error handler.

##Javascript var button = document.createElement('button'); button.addEventListener('click', document.createElement); window.onerror = setTimeout.bind(window, button.click); button.click();

Explanation: document.createElement() expects a parameter, so clicking the button causes an error to be thrown. The window catches the error and dispatches another click to the button. I don't think this meets the definition of recursion provided since the browser's event loop is invoking the error handler.

Javascript

<script>
    var button = document.createElement('button');
    button.addEventListener('click', document.createElement);
    window.onerror = setTimeout.bind(window, button.click);
    button.click();
</script>

Explanation: document.createElement() expects a parameter, so clicking the button causes an error to be thrown. The window catches the error and dispatches another click to the button. I don't think this meets the definition of recursion provided since the browser's event loop is invoking the error handler.

Source Link
aebabis
  • 443
  • 5
  • 11

##Javascript var button = document.createElement('button'); button.addEventListener('click', document.createElement); window.onerror = setTimeout.bind(window, button.click); button.click();

Explanation: document.createElement() expects a parameter, so clicking the button causes an error to be thrown. The window catches the error and dispatches another click to the button. I don't think this meets the definition of recursion provided since the browser's event loop is invoking the error handler.