<!DOCTYPE html>
<script src="../../resources/js-test-pre.js"></script>
<script>

description('Tests that we have the expected form in scope');

function dispatchClick(element)
{
    var clickEvent = document.createEvent('MouseEvent');
    clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
    element.dispatchEvent(clickEvent);
}

var expected;
var f = document.createElement('form');
var i = f.appendChild(document.createElement('input'));
i.setAttribute('onclick', 'expected = typeof action');
f.removeChild(i);
f = null;
gc();
dispatchClick(i);
shouldBeEqualToString('expected', 'undefined');

</script>
<script src="../../resources/js-test-post.js"></script>