<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Might there be a way that <script/> tags could add an
    attribute which combined the meaning of both "defer" and
    "document.write", whereby the last statement was evaluated to a
    string, but ideally treated, as far as the DOM, with the string
    being parsed and replacing the containing script node.<br>
    <br>
    For example:<br>
    <br>
    <div>
      <style type="text/css">pre.peachpuff_sh_sourceCode {
  background-color: #ffdab9;
  color: #000000;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_keyword {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_type {
  color: #2e8b57;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_string {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_regexp {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_specialchar {
  color: #6a5acd;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_comment {
  color: #406090;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_number {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_preproc {
  color: #cd00cd;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_function {
  color: #521cc7;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_url {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_date {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_time {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_file {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_ip {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_name {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_variable {
  color: #275fec;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_oldfile {
  color: #6a5acd;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_newfile {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_difflines {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_selector {
  color: #275fec;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_property {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_value {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

</style>
      <pre xmlns="http://www.w3.org/1999/xhtml" class="peachpuff_sh_sourceCode"><span class="peachpuff_sh_keyword"><script</span> <span class="peachpuff_sh_type">write</span><span class="peachpuff_sh_keyword">></span>
    '<span class="peachpuff_sh_keyword"><span</span> <span class="peachpuff_sh_type">onmouseover</span><span class="peachpuff_sh_symbol">=</span><span class="peachpuff_sh_string">"alert(\''+(new Date())+'\')"</span><span class="peachpuff_sh_keyword">></span>I\'ve got the date<span class="peachpuff_sh_keyword"></span></span>'
<span class="peachpuff_sh_keyword"></script></span></pre>
    </div>
    <br>
    If E4X were supported (since we otherwise lamentably have no
    PHP-style HEREDOC syntax in JavaScript to minimize the few warts
    above), allowing this to be used could be especially convenient:<br>
    <br>
    <div>
      <style type="text/css">pre.peachpuff_sh_sourceCode {
  background-color: #ffdab9;
  color: #000000;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_keyword {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_type {
  color: #2e8b57;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_string {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_regexp {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_specialchar {
  color: #6a5acd;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_comment {
  color: #406090;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_number {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_preproc {
  color: #cd00cd;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_function {
  color: #521cc7;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_url {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_date {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_time {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_file {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_ip {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_name {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_variable {
  color: #275fec;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_oldfile {
  color: #6a5acd;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_newfile {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_difflines {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_selector {
  color: #275fec;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_property {
  color: #a52a2a;
  font-weight: bold;
  font-style: normal;
}

pre.peachpuff_sh_sourceCode .peachpuff_sh_value {
  color: #c00058;
  font-weight: normal;
  font-style: normal;
}

</style>
      <pre xmlns="http://www.w3.org/1999/xhtml" class="peachpuff_sh_sourceCode"><span class="peachpuff_sh_keyword"><script</span> <span class="peachpuff_sh_type">write</span><span class="peachpuff_sh_keyword">></span>
    <span class="peachpuff_sh_keyword"><span</span> <span class="peachpuff_sh_type">onmouseover</span><span class="peachpuff_sh_symbol">=</span><span class="peachpuff_sh_string">"alert(new Date())"</span><span class="peachpuff_sh_keyword">></span>I've got the date<span class="peachpuff_sh_keyword"></span></span>
<span class="peachpuff_sh_keyword"></script></span></pre>
    </div>
    <br>
    (Maybe even a new <write/> tag could be made to do this
    exclusively and more succinctly.)<br>
    <br>
    I chose "defer" as the default behavior so as to be XHTML-friendly,
    to allow convenient reference by default to other DOM elements
    without the need for adding a listener, and the more appealing
    default behavior of not blocking other content from appearing.<br>
    <br>
    Since it doesn't seem that XQuery support will be making it into
    browsers anytime soon, it would be nice to be able to emulate its
    clean template-friendly declarative style, dropping the need to find
    and append to elements, etc..<br>
    <br>
    Brett<br>
    <br>
  </body>
</html>