From 1dafd08794f9886fd6da81ac26d47f124ad96025 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 21 Aug 2018 15:54:56 -0400 Subject: [PATCH] Editorial: Remove parameters from document.open() references This effectively reverts parts of 8f2816a2e89ce5614fac92ce2a8185070fc6b6e7. --- source | 87 +++++++++++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 46 deletions(-) diff --git a/source b/source index 13426f12b4c..203f33b4361 100644 --- a/source +++ b/source @@ -2930,6 +2930,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute constructing callback functions
  • converting to a sequence of Unicode scalar values
  • +
  • overload resolution algorithm
  • The Web IDL specification also defines the following types that are used in Web IDL fragments @@ -9168,7 +9169,7 @@ partial interface Document { readonly attribute HTMLOrSVGScriptElement? currentScript; // classic scripts in a document tree only // dynamic markup insertion - [CEReactions] Document open(optional DOMString type, optional DOMString replace); // both type and replace are ignored + [CEReactions] Document open(optional DOMString unused1, optional DOMString unused2); // both arguments are ignored WindowProxy open(USVString url, DOMString name, DOMString features); [CEReactions] void close(); [CEReactions] void write(DOMString... text); @@ -66097,8 +66098,7 @@ console.log(plasticButton.outerHTML); // will output '<button is="plastic-but this).

  • The constructor must not use the document.write() - or document.open(type, replace) - methods.

  • + or document.open() methods.

  • The element's attributes and children must not be inspected, as in the non-upgrade case none will be present, and relying on @@ -79513,10 +79513,10 @@ interface BarProp { origin assigned when the Document is created.

    -

    The document.open(type, - replace) method can change the Document's URL to "about:blank". Therefore the - origin is assigned when the Document is created.

    +

    The document.open() method can change + the Document's URL to + "about:blank". Therefore the origin is assigned when the + Document is created.

    @@ -86547,8 +86547,7 @@ interface ApplicationCache : EventTarget {

    For example, the URL of the responsible document is used to set the URL of the Document after it has been reset - using document.open(type, - replace).

    + using document.open().

    If the responsible event loop is not a browsing context event loop, then the environment settings object has no responsible document.

    @@ -89968,7 +89967,7 @@ dictionary PromiseRejectionEventInit : EventInit {

    This algorithm is used to define document.open(type, replace).

    + data-x="dom-document-open">document.open().

    To activate an event handler given an EventTarget object eventTarget and a string name that is the custom element constructors from being - able to use document.open(type, - replace), document.close(), and document.open(), document.close(), and document.write() when they are invoked by the parser. Initially, the counter must be set to zero.

    @@ -90938,18 +90937,13 @@ document.body.appendChild(frame)

    Opening the input stream

    -
    document = document . open( [ type [, replace ] ] )
    +
    document = document . open( )

    Causes the Document to be replaced in-place, as if it was a new Document object, but reusing the previous object, which is then returned.

    The resulting Document has an HTML parser associated with it, which can be given - data to parse using document.write(). (The - type argument is ignored.)

    - -

    If the replace argument is present and has the value "replace", the existing entries in the session history for the - Document object are removed.

    + data to parse using document.write().

    The method has no effect if the Document is still being parsed.

    @@ -90967,11 +90961,9 @@ document.body.appendChild(frame)

    Document objects have an ignore-opens-during-unload counter, which is - used to prevent scripts from invoking the document.open(type, replace) method - (directly or indirectly) while the document is being - unloaded. Initially, the counter must be set to zero.

    + used to prevent scripts from invoking the document.open() + method (directly or indirectly) while the document is being + unloaded. Initially, the counter must be set to zero.

    The document open steps, given a document, are as follows:

    @@ -91000,19 +90992,17 @@ document.body.appendChild(frame)

    If document has an active parser whose script nesting level is greater than 0, then return document.

    -

    This basically causes document.open(type, replace) to be - ignored when it's called in an inline script found during parsing, while still letting it have - an effect when called from a non-parser task such as a timer callback or event handler.

    +

    This basically causes document.open() to + be ignored when it's called in an inline script found during parsing, while still letting it + have an effect when called from a non-parser task such as a timer callback or event handler.

  • Similarly, if document's ignore-opens-during-unload counter is greater than 0, then return document.

    -

    This basically causes document.open(type, replace) to be - ignored when it's called from a beforeunload, This basically causes document.open() to + be ignored when it's called from a beforeunload, pagehide, or unload event handler while the Document is being unloaded.

  • @@ -91039,7 +91029,7 @@ document.body.appendChild(frame)
  • Create a new HTML parser and associate it with document. This is a script-created parser (meaning that it can be closed by the document.open(type, replace) and document.open() and document.close() methods, and that the tokenizer will wait for an explicit call to document.close() before emitting an end-of-file token). The encoding confidence is @@ -91057,11 +91047,17 @@ document.body.appendChild(frame)

    The document open steps do not affect whether a Document is ready for post-load tasks or completely loaded.

    -

    The open(type, - replace) method must return the result of running the document open +

    The open(unused1, + unused2) method must return the result of running the document open steps with this Document object. -

    The type argument is ignored.

    +

    The unused1 and + unused2 arguments are ignored, but kept in the IDL to allow code that calls the + function with one or two arguments to continue working. They are necessary due to Web IDL + overload resolution algorithm rules, which would throw a TypeError + exception for such calls had the arguments not been there. heycam/webidl#581 investigates changing the + algorithm to allow for their removal.

    The open(url, name, features) method must run these steps:

    @@ -91087,7 +91083,7 @@ document.body.appendChild(frame)

    Closes the input stream that was opened by the document.open(type, replace) method.

    + data-x="dom-document-open">document.open() method.

    Throws an "InvalidStateError" DOMException if the Document is an XML document.

    @@ -91147,9 +91143,9 @@ document.body.appendChild(frame) that does not correspond to the source of the document (e.g. if the string written is the string "<plaintext>" or "<!--"). In other cases, the call can clear the current page first, as if document.open(type, replace) had been - called. In yet more cases, the method is simply ignored, or throws an exception. Users agents - are explicitly allowed to avoid executing + data-x="dom-document-open">document.open() had been called. In yet more cases, the method + is simply ignored, or throws an exception. Users agents are explicitly allowed to avoid executing script elements inserted via this method. And to make matters even worse, the exact behavior of this method can in some cases be dependent on network latency