
     document.write('<!DOCTYPE html><html><body><some-element></some-element></body></html>');
     document.close();

     assert_true(executed, 'Must synchronously instantiate a custom element');
     return {window, document, exception};
 }

 promise_test(async function () {
     const result = await construct_custom_element_in_parser(this, (document) => document.open());
     assert_throws_dom('InvalidStateError', result.window.DOMException, () => { throw result.exception; }, 'Must throw an InvalidStat