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 17869 - Spec for document.open() doesn't match reality when the parser is script-created
Summary: Spec for document.open() doesn't match reality when the parser is script-created
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:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 07:09 UTC by contributor
Modified: 2013-03-15 22:41 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2012-07-18 07:09:15 UTC
This was was cloned from bug 17077 as part of operation convergence.
Originally filed: 2012-05-16 11:20:00 +0000
Original reporter: Henri Sivonen <hsivonen@iki.fi>

================================================================================
 #0   Henri Sivonen                                   2012-05-16 11:20:04 +0000 
--------------------------------------------------------------------------------
http://www.whatwg.org/specs/web-apps/current-work/#dom-document-open says, in part:

"If the document has an active parser that isn't a script-created parser, and the insertion point associated with that parser's input stream is not undefined (that is, it does point to somewhere in the input stream), then the method does nothing. Abort these steps and return the Document object on which the method was invoked."

AFAICT, the part " that isn't a script-created parser" is bogus per the behavior of Firefox (tested trunk), Chrome (tested dev), Opera (tested Next) and IE (tested 9).

See these demos:
http://hsivonen.iki.fi/test/moz/document-open-during-network-parse.html
http://hsivonen.iki.fi/test/moz/document-open-during-script-created-parse.html

(Aside: It seems that the spec sides with WebKit and Presto rather than Gecko and Trident on the " and return the Document object on which the method was invoked" point.)
================================================================================
 #1   Ian 'Hixie' Hickson                             2012-06-21 06:36:11 +0000 
--------------------------------------------------------------------------------
I wonder why I wrote that then. Weird.
================================================================================
Comment 1 Ian 'Hixie' Hickson 2012-09-28 19:12:29 UTC
http://www.hixie.ch/tests/adhoc/dom/level0/document/open/005.html is the test that led to the current text. It shows that document.open() does work while you're in a script-created parser.

But I guess this means this should be defined differently. Is it just that while the script nesting level is greater than zero (i.e. script is invoked from parser) you ignore document.open()?

(Regarding the return value, please file a separate bug if you want that changed.)
Comment 2 contributor 2013-03-15 22:41:43 UTC
Checked in as WHATWG revision r7757.
Check-in comment: Try to define when document.open() doesn't work more precisely.
http://html5.org/tools/web-apps-tracker?from=7756&to=7757