Warning:
This wiki has been archived and is now read-only.

NewDocument.WriteSpec

From HTML WG Wiki
Jump to: navigation, search

New document.write DOM specification

Problem statement / use cases

  • document.write is very convenient for authors because:
    • it can be used to inject HTML within a document
    • authors are familiar with it after years of availability
  • document.write has been discouraged in certain circles because it sometimes requires a re-parse of the document or an interruption in the parsing
  • XML does not permit the document.write method unless it is modernized

Proposed solution

Establish new DOM introspection method

A new method to return the location of a script. The method returns either the element the script is embedded in or null if the script is not an embedded script.

Re-implement document.write

Change the way document-write is implemented by using the new introspection DOM method and using setInnerHTML on that element, passing along the DOMString argument from document.write to setInnerHTML

Permit document.write in both serializations

Once document.write is modernized it can be used in documents from either the text/html serialization of the XML serialization.

Discussion and evaluation

Email

WG members should post feedback and other discussion to the WG’s list serve (the URI for the links below provides date information). Search on this email subject.

See also