This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21875 - open() doesn't always produce an insertion point, but write() assumes it does
Summary: open() doesn't always produce an insertion point, but write() assumes it does
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-30 12:23 UTC by contributor
Modified: 2013-05-28 20:47 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2013-04-30 12:23:59 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html
Multipage: http://www.whatwg.org/C#document.write()
Complete: http://www.whatwg.org/c#document.write()
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html

Comment:
open() doesn't always produce an insertion point

Posted from: 98.110.194.206 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20130419 Firefox/23.0
Comment 1 Boris Zbarsky 2013-04-30 12:27:03 UTC
Specifically, consider this testcase:

  var newDocument = document.implementation.createHTMLDocument( '' );
  newDocument.write( whatever );

In this case, I believe both the ignore-opens-during-unload counter and the ignore-opens-during-unload counter are 0, so step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-document-write calls open().  Step 2 of http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-document-ope aborts the steps, since the document is not active.  But write() makes no allowance for that, only for the user refusing for the document to be unloaded, and starts talking about insertion points, which is nonsensical in this case: there is no parser.
Comment 2 Ian 'Hixie' Hickson 2013-04-30 18:17:07 UTC
Should document.write() just abort on non-active documents? document.open() does, it seems like an oversight that document.write() doesn't.
Comment 3 Boris Zbarsky 2013-04-30 18:26:49 UTC
That would make sense to me, yes.
Comment 4 contributor 2013-05-28 20:47:16 UTC
Checked in as WHATWG revision r7869.
Check-in comment: Make document.write() a no-op on non-active documents.
http://html5.org/tools/web-apps-tracker?from=7868&to=7869