index.html
author Art Barstow <art.barstow@gmail.com>
Sun, 05 Oct 2014 08:38:12 -0400
changeset 75 5b04cbad78d9
parent 71 d86d21f30860
permissions -rw-r--r--
Add an explicit URL to file a bug
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     1
<!doctype html>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     2
<html>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     3
<head>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     4
    <meta charset=UTF-8>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     5
    <title>DOM Parsing and Serialization</title>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     6
    <style>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     7
        /* Make these stand-out more... */
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     8
        .externalDFN {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
     9
            font-style: italic;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    10
            background-color: #fff9d6;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    11
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    12
        /* Switch statement */
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    13
        dl.switch dt::before {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    14
            content: "↪ ";
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    15
            margin-left: 1em;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    16
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    17
        /* Better spacing around various lists (implied paragraph children) */
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    18
        ol > li, section:not(#toc) ul > li, section dl > dt {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    19
            margin: 1em 0;
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
    20
        }
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
    21
        var { color: maroon; }
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    22
        /* domintro styling */
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    23
        dl.domintro {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    24
            background-color: rgb(221, 255, 221);
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    25
            padding: 1em 0.5em 1em 2em;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    26
            clear: both;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    27
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    28
        dl.domintro dt {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    29
            color: black;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    30
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    31
        dl.domintro > dd {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    32
            color: green;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    33
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    34
        dl.domintro::before {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    35
            float: right;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    36
            background-color: white;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    37
            display: block;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    38
            border: 2px solid black;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    39
            color: green;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    40
            margin-top: -20px;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    41
            padding: 2px;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    42
            content: "This box is non-normative. Implementation requirements are given below this box.";
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    43
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    44
        /* Fancy table stuff */
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    45
        table {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    46
            border-collapse: collapse;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    47
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    48
        thead tr {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    49
            border-bottom: 2px solid black;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    50
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    51
        tbody tr:not(:last-child) {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    52
            border-bottom: 1px solid black;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    53
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    54
        td {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    55
            border-left: 1px solid black;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    56
            padding: 4px;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    57
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    58
        /* Extra IDL :-) */
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    59
        .extraidl {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    60
            line-height: 120%;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    61
            padding: 1em;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    62
            border-top: 1px solid #90b8de;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    63
            border-bottom: 1px solid #90b8de;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    64
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    65
        .extraidl:before {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    66
            width: 150px;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    67
            color: #fff;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    68
            padding: 3px;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    69
            font-weight: bold;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    70
            font-family: initial;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    71
            margin: -1em 0 1em -1em;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    72
            display: block;
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    73
            content: "WebIDL";
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    74
            background-color: rgb(144, 184, 222);
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    75
        }
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    76
    </style>
8
7bddbad3c43e Update http -> https
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 6
diff changeset
    77
    <script type="text/javascript" src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove' async></script>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    78
    <script type="text/javascript" src="respecConfig.js" class='remove'></script>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    79
</head>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    80
<body>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    81
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    82
    <section id="abstract">
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
    83
       <p>This specification defines various APIs for programmatic access to
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
    84
          HTML and generic XML parsers by web applications for use in parsing
24
42973d9748d9 Attempt to address: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18938
travil
parents: 23
diff changeset
    85
          and serializing DOM nodes.</p>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    86
    </section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    87
24
42973d9748d9 Attempt to address: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18938
travil
parents: 23
diff changeset
    88
    <section id="sotd">
42973d9748d9 Attempt to address: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18938
travil
parents: 23
diff changeset
    89
        <p>This specification is based on the original work of the <a href="http://domparsing.spec.whatwg.org/">
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
    90
            DOM Parsing and Serialization</a> Living Specification, though it has diverged in terms of
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
    91
            supported features, normative requirements, and algorithm specificity. As appropriate,
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
    92
            relevant fixes from the living specification are incorporated into this document.
24
42973d9748d9 Attempt to address: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18938
travil
parents: 23
diff changeset
    93
    </section>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
    94
71
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
    95
    <section id="crec" class="introductory">
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
    96
        <h2>Candidate Recommendation Exit Criteria</h2>
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
    97
        <p>This specification will not advance to Proposed Recommendation before the spec's 
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
    98
            <a href="http://w3c-test.org/domparsing/">test suite</a> is completed and two or 
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
    99
            more independent implementations pass each test, although no single implementation 
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
   100
            must pass each test. We expect to meet this criteria no sooner than 24 October 2014.
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
   101
            The group will also create an 
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
   102
            <a href="https://dvcs.w3.org/hg/innerhtml/raw-file/tip/implementationReport.html">Implementation Report</a>.
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
   103
    </section>
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
   104
    
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
   105
    <!-- <section id="issues" class="introductory">
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   106
        <h1>Issues</h1>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   107
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   108
        <p class=issue>Open issues that appear throughout the remainder of this
13
49bc54f5937f First issue removed, and issues section clarified.
travil
parents: 12
diff changeset
   109
        document will be highlighted like this.</p>
71
d86d21f30860 Update to Editor's draft which prepares the doc for CR:
travil
parents: 69
diff changeset
   110
    </section> -->
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   111
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   112
    <section id="conformance">
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   113
        <p>Requirements phrased in the imperative as part of algorithms
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   114
        (such as "strip any leading space characters" or "return false and
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   115
        terminate these steps") are to be interpreted with the meaning of the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   116
        key word ("must", "should", "may", etc) used in introducing the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   117
        algorithm.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   118
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   119
        <p>Conformance requirements phrased as algorithms or specific steps
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   120
        may be implemented in any manner, so long as the end result is
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   121
        equivalent. (In particular, the algorithms defined in this
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   122
        specification are intended to be easy to follow, and not intended to
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   123
        be performant.)</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   124
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   125
        <p id="hardwareLimitations">User agents may impose
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   126
        implementation-specific limits on otherwise unconstrained inputs,
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   127
        e.g. to prevent denial of service attacks, to guard against running
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   128
        out of memory, or to work around platform-specific limitations.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   129
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   130
        <p>When a method or an attribute is said to call another method or
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   131
        attribute, the user agent must invoke its internal API for that
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   132
        attribute or method so that e.g. the author can't change the behavior
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   133
        by overriding attributes or methods with custom properties or functions
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   134
        in ECMAScript.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   135
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   136
        <p>Unless otherwise stated, string comparisons are done in a <a
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   137
        data-spec="DOM4" class="externalDFN" title="case-sensitive">
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   138
        case-sensitive</a> manner.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   139
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   140
        <p>If an algorithm calls into another algorithm, any exception that is
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   141
        thrown by the latter (unless it is explicitly caught), must cause the
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   142
        former to terminate, and the exception to be propagated up to
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   143
        <em>its</em> caller.</p>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   144
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   145
        <section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   146
            <h2>Dependencies</h2>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   147
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   148
            <p>The IDL fragments in this specification must be interpreted as
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   149
            required for conforming IDL fragments, as described in the Web IDL
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   150
            specification. [[!WEBIDL]]</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   151
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   152
            <p>Some of the terms used in this specification are defined in
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   153
            [[DOM4]], [[HTML5]], and [[XML10]].
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   154
        </section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   155
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   156
        <section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   157
            <h2>Extensibility</h2>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   158
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   159
            <p>Vendor-specific proprietary extensions to this specification are
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   160
            strongly discouraged. Authors must not use such extensions, as
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   161
            doing so reduces interoperability and fragments the user base,
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   162
            allowing only users of specific user agents to access the content in
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   163
            question.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   164
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   165
            <p>If vendor-specific extensions are needed, the members should be
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   166
            prefixed by vendor-specific strings to prevent clashes with future
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   167
            versions of this specification. Extensions must be defined so that
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   168
            the use of extensions neither contradicts nor causes the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   169
            non-conformance of functionality defined in the specification.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   170
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   171
            <p>When vendor-neutral extensions to this specification are needed,
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   172
            either this specification can be updated accordingly, or an
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   173
            extension specification can be written that overrides the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   174
            requirements in this specification. When someone applying this
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   175
            specification to their activities decides that they will recognise
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   176
            the requirements of such an extension specification, it becomes an
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   177
            <dfn title="other applicable specifications">applicable
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   178
            specification</dfn> for the purposes of conformance requirements in
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   179
            this specification.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   180
            <!-- http://www.w3.org/mid/17E341CD-E790-422C-9F9A-69347EE01CEB@iki.fi -->
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   181
        </section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   182
    </section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   183
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   184
    <section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   185
        <h2>Terminology</h2>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   186
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   187
        <p>The term <dfn>context object</dfn> means the object on which the method or
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   188
        attribute being discussed was called.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   189
    </section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   190
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   191
    <section>
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   192
        <h2>Namespaces</h2>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   193
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   194
        <p>The <dfn title="html-ns">HTML namespace</dfn> is <code>http://www.w3.org/1999/xhtml</code>.
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   195
        <p>The <dfn title="xml-ns">XML namespace</dfn> is <code>http://www.w3.org/XML/1998/namespace</code>.
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   196
        <p>The <dfn title="xmlns-ns">XMLNS namespace</dfn> is <code>http://www.w3.org/2000/xmlns/</code>.
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   197
    </section>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   198
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   199
    <section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   200
        <h1>Parsing and serializing <a title="node" data-spec="DOM4" class="externalDFN">Node</a>s</h1>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   201
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   202
        <section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   203
            <h2>Parsing</h2>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   204
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   205
            <p>The following steps form the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   206
            <dfn title="concept-parse-fragment">fragment parsing algorithm</dfn>, whose
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   207
            arguments are a <var>markup</var> string and a
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   208
            <var>context element</var>:
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   209
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   210
            <ol>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   211
              <li>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   212
                <p>If the <var>context element</var>'s
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   213
                <a title="concept-node-document" data-spec="DOM4" class="externalDFN">node document</a>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   214
                is an <a title="html-document" data-spec="DOM4" class="externalDFN">HTML document</a>: let
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   215
                <var>algorithm</var> be the
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   216
                <a title="html-fragment-parsing-algorithm" data-spec="HTML5" class="externalDFN">HTML
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   217
                fragment parsing algorithm</a>.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   218
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   219
                <p>If the <var>context element</var>'s
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   220
                <a title="concept-node-document" data-spec="DOM4" class="externalDFN">node document</a>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   221
                is an <a title="xml-document" data-spec="DOM4" class="externalDFN">XML document</a>: let
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   222
                <var>algorithm</var> be the
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   223
                <a title="xml-fragment-parsing-algorithm" data-spec="HTML5" class="externalDFN">XML
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   224
                fragment parsing algorithm</a>.</p>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   225
              </li>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   226
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   227
              <li>Let <var>new children</var> be the result of invoking <var>algorithm</var> with <var>markup</var> as
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   228
              the <var>input</var>, and <var>context element</var> as the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   229
              <var><a data-spec="HTML5" title="concept-frag-parse-context" class="externalDFN">context</a></var>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   230
              element.</li>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   231
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   232
              <li>Let <var>fragment</var> be a new
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   233
              <code><a title="documentfragment" data-spec="DOM4" class="externalDFN">DocumentFragment</a></code> whose
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   234
              <a title="concept-node-document" data-spec="DOM4" class="externalDFN">node document</a>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   235
              is <var>context element</var>'s
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   236
              <a title="concept-node-document" data-spec="DOM4" class="externalDFN">node document</a>.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   237
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   238
              <li><a data-spec="DOM4" title="concept-node-append" class="externalDFN">Append</a>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   239
              each <a data-spec="DOM4" title="concept-node" class="externalDFN">node</a> in
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   240
              <var>new children</var> to <var>fragment</var>
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   241
              (in <a data-spec="DOM4" title="concept-tree-order" class="externalDFN">tree order</a>).
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   242
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   243
              <p class=note>This ensures the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   244
              <a title="concept-node-document" data-spec="DOM4" class="externalDFN">node document</a>
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
   245
              for the new <a data-spec="DOM4" title="concept-node" class="externalDFN">nodes</a> is correct.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   246
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   247
              <li>Return the value of <var>fragment</var>.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   248
            </ol>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   249
    </section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   250
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   251
    <section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   252
        <h2>Serializing</h2>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   253
        <p>The following steps form the
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   254
            <dfn title="concept-fragment-serializing-algorithm">fragment serializing algorithm</dfn>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   255
            whose arguments are a <code><a title="node" data-spec="DOM4" class="externalDFN">Node</a></code>
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   256
            <var>node</var> and a flag <dfn title="concept-well-formed">require well-formed</dfn>:
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   257
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   258
        <ol>
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   259
            <li>Let <var>context document</var> be the value of <var>node</var>'s
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   260
                <a title="concept-node-document" data-spec="DOM4" class="externalDFN">node document</a>.
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   261
            <li>If <var>context document</var> is an
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   262
                <a title="html-document" data-spec="DOM4" class="externalDFN">HTML document</a>,
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
   263
                return an <a title="concept-serialize-html">HTML serialization</a> of <var>node</var>.
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   264
            <li>Otherwise, <var>context document</var> is an
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   265
                <a title="xml-document" data-spec="DOM4" class="externalDFN">XML document</a>;
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   266
                return an <a title="concept-serialize-xml">XML serialization</a> of <var>node</var>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   267
                passing the flag <var>require well-formed</var>.
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   268
            <p class="note">The <a title="concept-serialize-xml">XML serialization</a> defined in this document
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   269
                conforms to the requirements of the <a data-spec="HTML5" title="xml-fragment-serialization-algorithm"
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   270
                class="externalDFN">XML fragment serialization algorithm</a> defined in [[HTML5]].</p>
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   271
        </ol>
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   272
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   273
        <p>To produce an <dfn title="concept-serialize-html">HTML serialization</dfn> of a
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   274
            <code><a title="node" data-spec="DOM4" class="externalDFN">Node</a></code> <var>node</var>, the user agent
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   275
            must run the
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   276
            <a data-spec="HTML5" title="html-fragment-serialization-algorithm" class="externalDFN">HTML
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   277
            fragment serialization algorithm</a> [[!HTML5]] on <var>node</var> and return the string produced.
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   278
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   279
        <p>To produce an <dfn title="concept-serialize-xml">XML serialization</dfn> of a
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   280
            <code><a title="node" data-spec="DOM4" class="externalDFN">Node</a></code> <var>node</var> given a
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   281
            flag <var>require well-formed</var>, run the following steps:
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   282
        <ol>
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   283
            <li>Let <dfn title="concept-context-namespace">context namespace</dfn> be <code>null</code>.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   284
                The <a title="concept-context-namespace">context namespace</a> is changed when a
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   285
                <var>node</var> serializes a different default namespace definition from its parent. The
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   286
                algorithm assumes no namespace to start.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   287
            <li>Let <dfn title="concept-namespace-prefix-map">namespace prefix map</dfn> be a new map
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   288
                for associating <code>namespaceURI</code> and namespace <code>prefix</code> pairs, where
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   289
                <code>namespaceURI</code> values are the map's keys, and <code>prefix</code> values are
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   290
                the map's key values. The <a title="concept-namespace-prefix-map">namespace prefix map</a>
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   291
                will be populated by previously seen namespaceURIs and their most recent prefix associations
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   292
                for a subtree. <span class="note"><strong>Note:</strong> the
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   293
                <a title="concept-namespace-prefix-map">namespace prefix map</a> only associates a single
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   294
                prefix value with a given namespaceURI. During serialization, if different namespace prefixes
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   295
                are found that map to the same namespaceURI, the last one encountered "wins" by replacing the
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   296
                existing key value in the map with the new prefix value.</span>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   297
            <li>Initialize the <a title="concept-namespace-prefix-map">namespace prefix map</a> with the
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   298
                <a title="xml-ns">XML namespace</a> key and string "<code>xml</code>" as the key value.
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   299
            <li>Let <dfn title="concept-generated-prefix">generated namespace prefix index</dfn> be an integer
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   300
                with a value of <code>1</code>. The <a title="concept-generated-prefix">generated namespace
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   301
                prefix index</a> is used to generate a new unique prefix value when no suitable existing
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   302
                namespace prefix is available to serialize a <var>node</var>'s namespaceURI (or the namespaceURI
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   303
                of one of <var>node</var>'s attributes). <span class="note">See the
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   304
                <a title="concept-generate-prefix">generate a prefix</a> algorithm.</span>
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   305
            <li>Return the result of running the <a title="concept-xml-serialization-algorithm">XML serialization
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   306
                algorithm</a> on <var>node</var> passing the <a title="concept-context-namespace">context
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   307
                namespace</a>, <a title="concept-namespace-prefix-map">namespace prefix map</a>,
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   308
                <a title="concept-generated-prefix">generated namespace prefix index</a> reference, and the
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   309
                flag <var>require well-formed</var>. If an <dfn title="concept-algorithm-exception">exception</dfn>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   310
                occurs during the execution of the algorithm, then catch that exception and throw a
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   311
                <code><a data-spec="DOM4" title="domexception" class="externalDFN">DOMException</a></code> with
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   312
                name "<code><a data-spec="DOM4" title="invalidstateerror" class="externalDFN">InvalidStateError</a></code>".
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   313
        </ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   314
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   315
        <p>An <a title="concept-serialize-xml">XML serialization</a> differs from an
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   316
            <a title="concept-serialize-html">HTML serialization</a> in the following ways:
35
c4fc4f1467ab Add note about the primary differences between and HTML and XML serialization
tleithea
parents: 34
diff changeset
   317
        <ul>
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   318
            <li><a title="element" data-spec="DOM4" class="externalDFN">Elements</a> and
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   319
                <a title="concept-attribute" data-spec="DOM4" class="externalDFN">attributes</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   320
                will always be serialized such that their namespaceURI is preserved. In some cases
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   321
                this means that an existing prefix, prefix declaration attribute or default namespace
45
cddb90aca176 Clarification on what the XML Serialization does to nodes and what guarantees it
travil
parents: 44
diff changeset
   322
                declaration attribute might be dropped, substituted or changed.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   323
                An <a title="concept-serialize-html">HTML serialization</a> does not attempt to
46
dbaee43f1d5b Fix bug 25029: Sync up the void element list with latest HTML5.1 list
travil
parents: 45
diff changeset
   324
                preserve the namespaceURI.
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   325
            <li><a title="element" data-spec="DOM4" class="externalDFN">Elements</a> not in the
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   326
                <a title="html-ns">HTML namespace</a> containing no <a title="concept-tree-child"
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   327
                data-spec="DOM4" class="externalDFN">children</a>, are serialized using
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   328
                the self-closing tag syntax (i.e., according to the <code>EmptyElemTag</code>
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   329
                production of [[XML10]]).
35
c4fc4f1467ab Add note about the primary differences between and HTML and XML serialization
tleithea
parents: 34
diff changeset
   330
        </ul>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   331
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   332
        <p>Otherwise, the algorithm for producing an <a title="concept-serialize-xml">XML serialization</a>
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   333
            is designed to produce a serialization that is compatible with the
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   334
            <a title="html-parser" data-spec="HTML5" class="externalDFN">HTML parser</a>. For example,
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   335
            elements in the <a title="html-ns">HTML namespace</a> that contain no child nodes are serialized
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   336
            with an explicit begin and end tag rather than using the self-closing tag syntax [[XML10]].
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   337
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   338
        <p class="note">Per [[DOM4]], <code><a title="interface-attr" data-spec="DOM4" class="externalDFN">Attr</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   339
            objects do not inherit from <code><a title="node" data-spec="DOM4" class="externalDFN">Node</a></code>, and thus cannot
52
de442ae4cc27 Oops, previous fix was wrong--Attr object serialization should throw.
travil
parents: 51
diff changeset
   340
            be serialized by the <a title="concept-xml-serialization-algorithm">XML serialization algorithm</a>.
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   341
            An attempt to serialize an <code><a title="interface-attr" data-spec="DOM4" class="externalDFN">Attr</a></code>
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   342
            object will result in a <code>TypeError</code> exception [[WEBIDL]].
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   343
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   344
        <p>To run the <dfn title="concept-xml-serialization-algorithm">XML serialization algorithm</dfn> on
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   345
            a <var>node</var> given a <a title="concept-context-namespace">context namespace</a>
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   346
            <var>namespace</var>, a <a title="concept-namespace-prefix-map">namespace prefix map</a>
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   347
            <var>prefix map</var>, a <a title="concept-generated-prefix">generated namespace prefix index</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   348
            <var>prefix index</var>, and a flag <var>require well-formed</var>, the user agent must run the
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   349
            appropriate steps, depending on <var>node</var>'s interface:</p>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   350
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   351
        <dl class=switch>
51
562246d9b452 Fix bug 25244: What do Attr objects serialize?
travil
parents: 50
diff changeset
   352
            <dt><code><a title="interface-element" data-spec="DOM4" class="externalDFN">Element</a></code>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   353
            <dd>
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   354
                <p>Run the following algorithm:
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   355
                <ol>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   356
                    <!-- "namespace" was passed via the caller, it's the default namespace scope -->
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   357
                    <!-- "prefix map" was passed via the caller, it's the namespace->prefix map -->
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   358
                    <!-- "prefix index" was passed via the caller, it's a number for generating prefixes if necessary -->
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   359
                    <!-- "require well-formed" was passed via the caller, it's a flag (true/false) for whether certain validation steps should be taken during serialization. -->
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   360
                    <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   361
                        <code>true</code>), and this <var>node</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   362
                        <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   363
                        attribute contains the character "<code>:</code>" (U+003A COLON) or does not match the
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   364
                        XML <code>Name</code> production [[XML10]], then <a title="concept-algorithm-exception">throw an
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   365
                        exception</a>; the serialization of this <var>node</var> would not be a well-formed element.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   366
                    <li>Let <var>markup</var> be the string "<code>&lt;</code>" (U+003C LESS-THAN SIGN).
36
393c42a44e7f Fix Bug 25062, and some cleanup of the Element serialization algorithm
travil@microsoft.com
parents: 35
diff changeset
   367
                    <li>Let <var>qualified name</var> be an empty string.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   368
                    <li>Let a <var>skip end tag</var> flag have the value <code>false</code>.
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   369
                    <li>Let an <var>ignore namespace definition attribute</var> flag have the value <code>false</code>.
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   370
                    <li>Let <var>map</var> be a copy of the <var>prefix map</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   371
                    <li>Let <var>element prefixes list</var> be an empty list. <span class="note">This list is
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   372
                        local to each element. Its purpose is to ensure that there are no conflicting prefixes
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   373
                        should a new namespace prefix attribute need to be generated.</span>
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   374
                    <li>Let <var>duplicate prefix definition</var> be <code>null</code>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   375
                    <li>Let <var>local default namespace</var> be the result of
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   376
                        <a title="concept-record-namespace-info">recording the namespace information</a> for
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   377
                        <var>node</var> given <var>map</var>, <var>element prefixes list</var>, and
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   378
                        <var>duplicate prefix definition</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   379
                    <p class="note">This above step will update the <var>map</var> with any found namespace prefix
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   380
                        definitions, add the found prefix definitions to the <var>element prefixes list</var>, optionally
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   381
                        set the <var>duplicate prefix definition</var> value, and return a local default namespace
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   382
                        value defined by a default namespace attribute if one exists. Otherwise it returns
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   383
                        <code>null</code>.</p>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   384
                    <li>Let <var>inherited ns</var> be a copy of <var>namespace</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   385
                    <li>Let <var>ns</var> be the value of <var>node</var>'s
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
   386
                        <code><a title="dom-element-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   387
                        attribute.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   388
                    <li>If <var>inherited ns</var> is equal to <var>ns</var>, then:
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   389
                    <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   390
                        <li>If <var>local default namespace</var> is not <code>null</code>, then set <var>ignore
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   391
                            namespace definition attribute</var> to <code>true</code>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   392
                        <li>If <var>ns</var> is the <a title="xml-ns">XML namespace</a>, then let <var>qualified name</var>
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   393
                            be the concatenation of the string "<code>xml:</code>" and the value of <var>node</var>'s
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   394
                            <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   395
                        <li>Otherwise, let <var>qualified name</var> be the value of <var>node</var>'s
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   396
                            <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>.
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   397
                            <span class="note">The <var>node</var>'s prefix is always dropped.</span>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   398
                        <li>Append the value of <var>qualified name</var> to <var>markup</var>.
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   399
                    </ol>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   400
                    <li>Otherwise, <var>inherited ns</var> is not equal to <var>ns</var> (the <var>node</var>'s
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   401
                        own namespace is different from the context namespace of its parent). Run these sub-steps:
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   402
                    <!-- The serialization algorithm must differentiate this node's namespace from it's parent's default
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   403
                        namespace. There are two ways to do this: (1) [preferred due to assumed minimum length] use a
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   404
                        namespace prefix if one is available or (2) use a default namespace declaration. Both cases can
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   405
                        run into conflicts with existing attributes on the element and are handled accordingly. -->
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   406
                    <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   407
                        <li>Let <var>prefix</var> be the value of <var>node</var>'s
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   408
                            <code><a title="dom-element-prefix" data-spec="DOM4" class="externalDFN">prefix</a></code>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   409
                            attribute.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   410
                        <li>Let <var>candidate prefix</var> be a value from <var>map</var> where there exists a key in
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   411
                            <var>map</var> that matches the value of <var>ns</var> or if there is no such key, then let
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   412
                            <var>candidate prefix</var> be <code>null</code>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   413
                        <!-- Found a suitable prefix to use, either locally, or inherited through a parent node that
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   414
                            matches the node's namespaceURI. This prefix will be used in serialization even if the node
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   415
                            doesn't have a real prefix. -->
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   416
                        <li>If <var>candidate prefix</var> is not <code>null</code> (a suitable namespace prefix is defined
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   417
                            which maps to <var>ns</var>), then:
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   418
                        <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   419
                            <li>Let <var>qualified name</var> be the concatenation of <var>candidate prefix</var>,
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   420
                                "<code>:</code>" (U+003A COLON), and <var>node</var>'s <code>
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   421
                                <a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   422
                                <span class="note">There exists on this <var>node</var> or the <var>node</var>'s ancestry a
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   423
                                namespace prefix definition that defines the <var>node</var>'s namespace.</span>
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   424
                            <li>If <var>local default namespace</var> is not <code>null</code> (there exists a locally-defined
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   425
                                default namespace declaration attribute), then let <var>inherited ns</var> get the value of
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   426
                                <var>ns</var>.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   427
                            <li>Append the value of <var>qualified name</var> to <var>markup</var>.
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   428
                        </ol>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   429
                        <!-- Now there's no existing namespace->prefix mapping to override; try to use a prefix: -->
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   430
                        <li>Otherwise, if <var>prefix</var> is not <code>null</code> and <var>local default namespace</var> is
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   431
                            <code>null</code>, then:
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   432
                        <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   433
                            <li>If the <var>element prefixes list</var> contains the value of <var>prefix</var>, then
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   434
                                let <var>prefix</var> be the result of
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   435
                                <a title="concept-generate-prefix">generating a prefix</a> providing as input the
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   436
                                <a title="concept-namespace-prefix-map">namespace prefix map</a> <var>map</var>,
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   437
                                <var>node</var>'s <var>ns</var> string, and the <var>prefix index</var> integer.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   438
                            <li>Otherwise, append to <var>map</var> a new key <var>ns</var> whose key value is
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   439
                                <var>prefix</var>.
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   440
                            <!-- Prefix is now either real or generated, and added to the map. -->
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   441
                            <li>Let <var>qualified name</var> be the concatenation
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   442
                            of <var>prefix</var>, "<code>:</code>" (U+003A COLON), and <var>node</var>'s
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   443
                            <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>.
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   444
                            <li>Append the value of <var>qualified name</var> to <var>markup</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   445
                            <li>Append the following to <var>markup</var>, in the order listed: <span class="note">The following
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   446
                                serializes the new namespace/prefix association just added to the <var>map</var>.</span>
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   447
                            <ol>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   448
                                <li>"<code> </code>" (U+0020 SPACE);
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   449
                                <li>The string "<code>xmlns:</code>";
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   450
                                <li>The value of <var>prefix</var>;
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   451
                                <li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   452
                                <li>The result of <a title="concept-serialize-attr-value">serializing an attribute value</a>
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   453
                                    given <var>ns</var> and the <a title="concept-well-formed">require well-formed</a> flag
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   454
                                    as input;
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   455
                                <li>"<code>"</code>" (U+0022 QUOTATION MARK).
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   456
                            </ol>
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   457
                        </ol>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   458
                        <!-- Giving up on the prefix route, try to use a default namespace instead (stomping on an existing
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   459
                             one if necessary) and dropping the node's prefix -->
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   460
                        <li>Otherwise, if <var>local default namespace</var> is <code>null</code>, or <var>local default
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   461
                            namespace</var> is not <code>null</code> and its value is not equal to <var>ns</var>, then:
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   462
                        <ol>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   463
                            <li>Set the <var>ignore namespace definition attribute</var> flag to <code>true</code>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   464
                            <li>Let <var>qualified name</var> be the value of <var>node</var>'s <code><a title="dom-element-localname"
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   465
                                data-spec="DOM4" class="externalDFN">localName</a></code>.
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   466
                            <li>Let the value of <var>inherited ns</var> be <var>ns</var>. <span class="note">The new
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   467
                                default namespace will be used in the serialization to define this <var>node</var>'s
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   468
                                namespace and act as the context namespace for its <a title="concept-tree-child"
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   469
                                data-spec="DOM4" class="externalDFN">children</a>.</span>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   470
                            <li>Append the value of <var>qualified name</var> to <var>markup</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   471
                            <li>Append the following to <var>markup</var>, in the order listed: <span class="note">The following
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   472
                                serializes the new (or replacement) default namespace definition.</span>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   473
                            <ol>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   474
                                <li>"<code> </code>" (U+0020 SPACE);
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   475
                                <li>The string "<code>xmlns</code>";
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   476
                                <li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   477
                                <li>The result of <a title="concept-serialize-attr-value">serializing an attribute value</a>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   478
                                    given <var>ns</var> and the <a title="concept-well-formed">require well-formed</a> flag
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   479
                                    as input;
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   480
                                <li>"<code>"</code>" (U+0022 QUOTATION MARK).
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   481
                            </ol>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   482
                        </ol>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   483
                        <!-- Finally, regardless of prefix, the node has a local default namespace that matches 'ns'.
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   484
                            So, we'll just use that and drop the prefix -->
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   485
                        <li>Otherwise, the <var>node</var> has a <var>local default namespace</var> that matches
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   486
                            <var>ns</var>. Let <var>qualified name</var> be the value of <var>node</var>'s
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   487
                            <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   488
                            let the value of <var>inherited ns</var> be <var>ns</var>, and append the value of
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   489
                            <var>qualified name</var> to <var>markup</var>.
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   490
                    </ol>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   491
                    <li>Append to <var>markup</var> the result of the
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   492
                        <a title="concept-serialize-xml-attributes">XML serialization of <var>node</var>'s
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   493
                        attributes</a> given the
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   494
                        <a title="concept-namespace-prefix-map">namespace prefix map</a> <var>map</var>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   495
                        the <a title="concept-generated-prefix">generated prefix index</a> <var>prefix index</var>, the
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   496
                        flag <var>ignore namespace definition attribute</var> and the value of <var>duplicate
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   497
                        prefix definition</var>.
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   498
                    <li>If <var>ns</var> is the <a title="html-ns">HTML namespace</a>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   499
                        and the <var>node</var>'s list of
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   500
                        <a title="concept-tree-child" data-spec="DOM4" class="externalDFN">children</a>
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   501
                        is empty, and the <var>node</var>'s
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   502
                        <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   503
                        matches any one of the following
20
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   504
                        <a title="void-elements" data-spec="HTML5" class="externalDFN">void elements</a>:
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   505
                        "<code>area</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   506
                        "<code>base</code>",
46
dbaee43f1d5b Fix bug 25029: Sync up the void element list with latest HTML5.1 list
travil
parents: 45
diff changeset
   507
                        "<code>basefont</code>",
dbaee43f1d5b Fix bug 25029: Sync up the void element list with latest HTML5.1 list
travil
parents: 45
diff changeset
   508
                        "<code>bgsound</code>",
20
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   509
                        "<code>br</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   510
                        "<code>col</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   511
                        "<code>embed</code>",
46
dbaee43f1d5b Fix bug 25029: Sync up the void element list with latest HTML5.1 list
travil
parents: 45
diff changeset
   512
                        "<code>frame</code>",
20
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   513
                        "<code>hr</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   514
                        "<code>img</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   515
                        "<code>input</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   516
                        "<code>keygen</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   517
                        "<code>link</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   518
                        "<code>menuitem</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   519
                        "<code>meta</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   520
                        "<code>param</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   521
                        "<code>source</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   522
                        "<code>track</code>",
a00491801887 Fixed list of void elements and link to HTML5.
travil
parents: 19
diff changeset
   523
                        "<code>wbr</code>";
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   524
                        then append the following to <var>markup</var>, in the order listed:
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   525
                        <ol>
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   526
                            <li>"<code> </code>" (U+0020 SPACE);
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   527
                            <li>"<code>/</code>" (U+002F SOLIDUS).
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   528
                        </ol>
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   529
                        and set the <var>skip end tag</var> flag to <code>true</code>.
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   530
                    <li>If <var>ns</var> is not the <a title="html-ns">HTML namespace</a>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   531
                        and the <var>node</var>'s list of
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   532
                        <a title="concept-tree-child" data-spec="DOM4" class="externalDFN">children</a>
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   533
                        is empty, then append "<code>/</code>" (U+002F SOLIDUS) to <var>markup</var>
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   534
                        and set the <var>skip end tag</var> flag to <code>true</code>.
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   535
                    <li>Append "<code>&gt;</code>" (U+003E GREATER-THAN SIGN) to <var>markup</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   536
                    <li>If the value of <var>skip end tag</var> is <code>true</code>, then return
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   537
                        the value of <var>markup</var> and skip the remaining steps. The
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   538
                        <var>node</var> is a leaf-node.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   539
                    <li>If <var>ns</var> is the <a title="html-ns">HTML namespace</a>, and the <var>node</var>'s
53
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   540
                        <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   541
                        matches the string "<code>template</code>", then this is a
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   542
                        <code><a title="the-template-element" data-spec="HTML5" class="externalDFN">template</a></code> element.
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   543
                        Append to <var>markup</var> the result of running the
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   544
                        <a title="concept-xml-serialization-algorithm">XML serialization algorithm</a> on the
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   545
                        <a title="the-template-element" data-spec="HTML5" class="externalDFN">template</a> element's
53
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   546
                        <a title="template-contents" data-spec="HTML5" class="externalDFN">template contents</a>
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   547
                        (a <code><a title="interface-documentfragment" data-spec="DOM4" class="externalDFN">DocumentFragment</a></code>),
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   548
                        providing the value of <var>inherited ns</var> for the
53
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   549
                        <a title="concept-context-namespace">context namespace</a>,
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   550
                        <var>map</var> for the <a title="concept-namespace-prefix-map">namespace prefix map</a>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   551
                        <var>prefix index</var> for the
53
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   552
                        <a title="concept-generated-prefix">generated namespace prefix index</a>, and the value
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   553
                        of the <var>require well-formed</var> flag. <span class="note">This allows
53
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   554
                        <a title="template-contents" data-spec="HTML5" class="externalDFN">template content</a> to
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   555
                        round-trip , given the rules for
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   556
                        <a title="parsing-xhtml-documents" data-spec="HTML5" class="externalDFN">parsing XHTML documents</a>
619b91c88dc8 Fix bug 25180: Handle <template> element serialization
travil
parents: 52
diff changeset
   557
                        [[HTML5]].</span>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   558
                    <li>Otherwise, append to <var>markup</var> the result of running the
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   559
                        <a title="concept-xml-serialization-algorithm">XML serialization algorithm</a> on each
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   560
                        of <var>node</var>'s
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   561
                        <a title="concept-tree-child" data-spec="DOM4" class="externalDFN">children</a>,
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   562
                        in <a data-spec="DOM4" title="concept-tree-order" class="externalDFN">tree order</a>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   563
                        providing the value of <var>inherited ns</var> for the
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   564
                        <a title="concept-context-namespace">context namespace</a>,
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   565
                        <var>map</var> for the <a title="concept-namespace-prefix-map">namespace prefix map</a>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   566
                        <var>prefix index</var> for the
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   567
                        <a title="concept-generated-prefix">generated namespace prefix index</a>, and the value
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   568
                        of the <var>require well-formed</var> flag.
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   569
                    <li>Append the following to <var>markup</var>, in the order listed:
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   570
                        <ol>
37
c80b719c8211 Correction to the namespace prefix matching sub-steps--they must only consider real XMLNS attributes.
travil@microsoft.com
parents: 36
diff changeset
   571
                            <li>"<code>&lt;/</code>" (U+003C LESS-THAN SIGN, U+002F SOLIDUS);
c80b719c8211 Correction to the namespace prefix matching sub-steps--they must only consider real XMLNS attributes.
travil@microsoft.com
parents: 36
diff changeset
   572
                            <li>The value of <var>qualified name</var>;
c80b719c8211 Correction to the namespace prefix matching sub-steps--they must only consider real XMLNS attributes.
travil@microsoft.com
parents: 36
diff changeset
   573
                            <li>"<code>&gt;</code>" (U+003E GREATER-THAN SIGN).
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   574
                        </ol>
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   575
                    <li>Return the value of <var>markup</var>.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   576
                </ol>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   577
51
562246d9b452 Fix bug 25244: What do Attr objects serialize?
travil
parents: 50
diff changeset
   578
            <dt><code><a title="interface-document" data-spec="DOM4" class="externalDFN">Document</a></code>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   579
            <dd>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   580
                <p>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   581
                    <code>true</code>), and this <var>node</var> has no
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   582
                    <code><a title="dom-document-documentelement" data-spec="DOM4" class="externalDFN">documentElement</a></code>
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   583
                    (the <code><a title="dom-document-documentelement" data-spec="DOM4" class="externalDFN">documentElement</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   584
                    attribute's value is <code>null</code>), then <a title="concept-algorithm-exception">throw an
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   585
                    exception</a>; the serialization of this <var>node</var> would not be a well-formed document.
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   586
                <p>Otherwise, run the following steps:
21
75b83ca5f00c Fix Document XML serialization.
travil
parents: 20
diff changeset
   587
                <ol>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   588
                    <li>Let <var>serialized document</var> be an empty string.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   589
                    <li>Append to <var>serialized document</var> the string produced by running the steps to
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
   590
                        <a title="concept-serialize-doctype">produce a DocumentType serialization</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   591
                        of <var>node</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   592
                        <code><a title="dom-document-doctype" data-spec="DOM4" class="externalDFN">doctype</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   593
                        attribute provided the <var>require well-formed</var> flag if <var>node</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   594
                        <code><a title="dom-document-doctype" data-spec="DOM4" class="externalDFN">doctype</a></code>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   595
                        attribute is not <code>null</code>.
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   596
                    <li>For each <a title="concept-tree-child" data-spec="DOM4" class="externalDFN">child</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   597
                        <var>child</var> of <var>node</var>, in
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   598
                        <a data-spec="DOM4" title="concept-tree-order" class="externalDFN">tree order</a>, run the
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   599
                        <a title="concept-xml-serialization-algorithm">XML serialization algorithm</a>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   600
                        on the <var>child</var> given a <a title="concept-context-namespace">context namespace</a>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   601
                        <var>namespace</var>, a <a title="concept-namespace-prefix-map">namespace prefix map</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   602
                        <var>prefix map</var>, a reference to a <a title="concept-generated-prefix">generated
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   603
                        namespace prefix index</a> <var>prefix index</var>, flag <var>require well-formed</var>, and
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   604
                        append the result to <var>serialized document</var>.
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   605
                    <li>Return the value of <var>serialized document</var>.
21
75b83ca5f00c Fix Document XML serialization.
travil
parents: 20
diff changeset
   606
                </ol>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   607
51
562246d9b452 Fix bug 25244: What do Attr objects serialize?
travil
parents: 50
diff changeset
   608
            <dt><code><a title="interface-comment" data-spec="DOM4" class="externalDFN">Comment</a></code>
32
f4430fb3b150 Sync-up to the Living Specification's changes:
travil
parents: 31
diff changeset
   609
            <dd>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   610
                <p>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   611
                    <code>true</code>), and <var>node</var>'s
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   612
                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   613
                    contains characters that are not matched by the XML <code>Char</code> production [[XML10]] or
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   614
                    contains "<code>--</code>" (two adjacent U+002D HYPHEN-MINUS characters) or that ends with
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   615
                    a "<code>-</code>" (U+002D HYPHEN-MINUS) character, then
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   616
                    <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   617
                    <var>node</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   618
                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   619
                    would not be well-formed.
32
f4430fb3b150 Sync-up to the Living Specification's changes:
travil
parents: 31
diff changeset
   620
                <p>Return the concatenation of "<code>&lt;!--</code>", <var>node</var>'s
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   621
                <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>, and
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   622
                "<code>--></code>".
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   623
47
1920f7b853a1 Fix bug 23936: [LC Comment] Source reference to DOM L2 Core
travil
parents: 46
diff changeset
   624
            <!-- Removing CDATA Serialization steps as this interface type is removed from DOM4:
14
edebbe3facb6 Add support for CDATA serializations in DOM (for XML and programmatic creation).
travil
parents: 13
diff changeset
   625
            <dt><code><a title="cdata" data-spec="DOML2" class="externalDFN">CDATASection</a></code>
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   626
            <dd><ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   627
                <li>Let <var>markup</var> be the concatenation of "<code>&lt;![CDATA[</code>",
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   628
                    <var>node</var>'s <code><a title="dom-characterdata-data" data-spec="DOM4"
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   629
                    class="externalDFN">data</a></code>, and "<code>]]></code>".
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   630
                <li>Return the value of <var>markup</var>.
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   631
              </ol>
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   632
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   633
              <p class=note>CDATASection objects may be created by the historical
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   634
            <code>document.createCDATASection</code> API, or as a result of parsing an
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   635
            <a title="xml-document" data-spec="DOM4" class="externalDFN">XML document</a>.
47
1920f7b853a1 Fix bug 23936: [LC Comment] Source reference to DOM L2 Core
travil
parents: 46
diff changeset
   636
            -->
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   637
51
562246d9b452 Fix bug 25244: What do Attr objects serialize?
travil
parents: 50
diff changeset
   638
            <dt><code><a title="interface-text" data-spec="DOM4" class="externalDFN">Text</a></code>
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   639
            <dd><ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   640
                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   641
                    <code>true</code>), and <var>node</var>'s
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   642
                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   643
                    contains characters that are not matched by the XML <code>Char</code> production [[XML10]],
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   644
                    then <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   645
                    <var>node</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   646
                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   647
                    would not be well-formed.
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   648
                <li>Let <var>markup</var> be the value of <var>node</var>'s
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   649
                <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   650
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   651
                <li>Replace any occurrences of "<code>&amp;</code>" in <var>markup</var> by
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   652
                "<code>&amp;amp;</code>".
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   653
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   654
                <li>Replace any occurrences of "<code>&lt;</code>" in <var>markup</var> by
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   655
                "<code>&amp;lt;</code>".
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   656
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   657
                <li>Replace any occurrences of "<code>&gt;</code>" in <var>markup</var> by
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   658
                "<code>&amp;gt;</code>".
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   659
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   660
                <li>Return the value of <var>markup</var>.
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   661
              </ol>
51
562246d9b452 Fix bug 25244: What do Attr objects serialize?
travil
parents: 50
diff changeset
   662
            <dt><code><a title="interface-documentfragment" data-spec="DOM4" class="externalDFN">DocumentFragment</a></code>
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   663
            <dd><ol>
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   664
                <li>Let <var>markup</var> the empty string.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   665
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   666
                <li>For each <a title="concept-tree-child" data-spec="DOM4" class="externalDFN">child</a>
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   667
                    <var>child</var> of <var>node</var>, in
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   668
                    <a data-spec="DOM4" title="concept-tree-order" class="externalDFN">tree order</a>,
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   669
                    run the <a title="concept-xml-serialization-algorithm">XML serialization algorithm</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   670
                    on the <var>child</var> given
43
a702e4acefbf Update the DocumentFragment call to the XML Serilizer to provide the necessary
travil
parents: 42
diff changeset
   671
                    a <a title="concept-context-namespace">context namespace</a> <var>namespace</var>, a
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   672
                    <a title="concept-namespace-prefix-map">namespace prefix map</a> <var>prefix map</var>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   673
                    a reference to a <a title="concept-generated-prefix">generated namespace prefix index</a>
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   674
                    <var>prefix index</var>, and flag <var>require well-formed</var>. Concatenate the result
49
bf16edd32039 Fix bug 25181: Enable the innerHTML and outerHTML getter calls to invoke the serialize steps directly
travil
parents: 47
diff changeset
   675
                    to <var>markup</var>.
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   676
                <li>Return the value of <var>markup</var>.
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   677
              </ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   678
51
562246d9b452 Fix bug 25244: What do Attr objects serialize?
travil
parents: 50
diff changeset
   679
            <dt><code><a title="interface-documenttype" data-spec="DOM4" class="externalDFN">DocumentType</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   680
            <dd>Run the steps to <a title="concept-serialize-doctype">produce a DocumentType
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   681
                serialization</a> of <var>node</var> given the <a title="concept-well-formed">require well-formed</a>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   682
                flag, and return the string this produced.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   683
51
562246d9b452 Fix bug 25244: What do Attr objects serialize?
travil
parents: 50
diff changeset
   684
            <dt><code><a title="interface-processinginstruction" data-spec="DOM4" class="externalDFN">ProcessingInstruction</a></code>
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   685
            <dd><ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   686
                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   687
                    <code>true</code>), and <var>node</var>'s
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   688
                    <code><a title="dom-processinginstruction-target" data-spec="DOM4" class="externalDFN">target</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   689
                    contains a "<code>:</code>" (U+003A COLON) character or is an
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   690
                    <a data-spec="DOM4" class="externalDFN" title="ascii-case-insensitive">ASCII case-insensitive</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   691
                    match for the string "<code>xml</code>", then <a title="concept-algorithm-exception">throw an
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   692
                    exception</a>; the serialization of this <var>node</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   693
                    <code><a title="dom-processinginstruction-target" data-spec="DOM4" class="externalDFN">target</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   694
                    would not be well-formed.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   695
                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   696
                    <code>true</code>), and <var>node</var>'s
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   697
                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   698
                    contains characters that are not matched by the XML <code>Char</code> production [[XML10]] or
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   699
                    contains the string "<code>?></code>" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN),
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   700
                    then <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   701
                    <var>node</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   702
                    <code><a title="dom-characterdata-data" data-spec="DOM4" class="externalDFN">data</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   703
                    would not be well-formed.
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   704
                <li>Let <var>markup</var> be the concatenation of the following, in the order listed:
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   705
                <ol>
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   706
                    <li>"<code>&lt;?</code>" (U+003C LESS-THAN SIGN, U+003F QUESTION MARK);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   707
                    <li>The value of <var>node</var>'s <code><a title="dom-processinginstruction-target"
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   708
                        data-spec="DOM4" class="externalDFN">target</a></code>;
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   709
                    <li>"<code> </code>" (U+0020 SPACE);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   710
                    <li>The value of <var>node</var>'s <code><a title="dom-characterdata-data"
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   711
                        data-spec="DOM4" class="externalDFN">data</a></code>;
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   712
                    <li>"<code>?></code>" (U+003F QUESTION MARK, U+003E GREATER-THAN SIGN).
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   713
                </ol>
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   714
                <li>Return the value of <var>markup</var>.
15
072801890ccd Add support for DOCTYPE serialization on XML docs. Fixed an error with Text in
travil
parents: 14
diff changeset
   715
              </ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   716
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   717
        </dl>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   718
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
   719
        <p>To <dfn title="concept-serialize-doctype">produce a DocumentType serialization</dfn> of a
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   720
            <code><a title="node" data-spec="DOM4" class="externalDFN">Node</a></code> <var>node</var>, given a
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   721
            <a title="concept-well-formed">require well-formed</a> flag, the user agent must return
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   722
            the result of the following algorithm:</p>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   723
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   724
        <ol>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   725
            <li>If the <a title="concept-well-formed">require well-formed</a> flag is <code>true</code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   726
                and the <var>node</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   727
                <code><a title="dom-documenttype-publicid" data-spec="DOM4" class="externalDFN">publicId</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   728
                attribute contains characters that are not matched by the XML <code>PubidChar</code> production
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   729
                [[XML10]], then <a title="concept-algorithm-exception">throw an exception</a>; the serialization
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   730
                of this <var>node</var> would not be a well-formed document type declaration.
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   731
            <li>If the <a title="concept-well-formed">require well-formed</a> flag is <code>true</code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   732
                and the <var>node</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   733
                <code><a title="dom-documenttype-systemid" data-spec="DOM4" class="externalDFN">systemId</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   734
                attribute contains characters that are not matched by the XML <code>Char</code> production
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   735
                [[XML10]] or that contains both a "<code>"</code>" (U+0022 QUOTATION MARK) and a "<code>'</code>"
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   736
                (U+0027 APOSTROPHE), then <a title="concept-algorithm-exception">throw an exception</a>; the
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   737
                serialization of this <var>node</var> would not be a well-formed document type declaration.
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   738
            <li>Let <var>markup</var> be an empty string.
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   739
            <li>Append the string "<code>&lt;!DOCTYPE</code>" to <var>markup</var>.
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   740
            <li>Append "<code> </code>" (U+0020 SPACE) to <var>markup</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   741
            <li>Append the value of the <var>node</var>'s
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   742
                <code><a title="dom-documenttype-name" data-spec="DOM4" class="externalDFN">name</a></code>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   743
                attribute to <var>markup</var>. For a <var>node</var> belonging to an
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   744
                <a title="html-document" data-spec="DOM4" class="externalDFN">HTML document</a>,
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   745
                the value will be all lowercase.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   746
            <li>If the <var>node</var>'s
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   747
                <code><a title="dom-documenttype-publicid" data-spec="DOM4" class="externalDFN">publicId</a></code>
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   748
                is not the empty string then append the following, in the order listed, to <var>markup</var>:
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   749
                <ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   750
                    <li>"<code> </code>" (U+0020 SPACE);
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   751
                    <li>The string "<code>PUBLIC</code>";
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   752
                    <li>"<code> </code>" (U+0020 SPACE);
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   753
                    <li>"<code>"</code>" (U+0022 QUOTATION MARK);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   754
                    <li>The value of the <var>node</var>'s
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   755
                        <code><a title="dom-documenttype-publicid" data-spec="DOM4" class="externalDFN">publicId</a></code>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   756
                        attribute;
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   757
                    <li>"<code>"</code>" (U+0022 QUOTATION MARK).
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   758
                </ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   759
            </li>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   760
            <li>If the <var>node</var>'s
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   761
                <code><a title="dom-documenttype-systemid" data-spec="DOM4" class="externalDFN">systemId</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   762
                is not the empty string and the <var>node</var>'s
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   763
                <code><a title="dom-documenttype-publicid" data-spec="DOM4" class="externalDFN">publicId</a></code>
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   764
                is set to the empty string, then append the following, in the order listed, to <var>markup</var>:
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   765
                <ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   766
                    <li>"<code> </code>" (U+0020 SPACE);
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   767
                    <li>The string "<code>SYSTEM</code>".
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   768
                </ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   769
            </li>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   770
            <li>If the <var>node</var>'s
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   771
                <code><a title="dom-documenttype-systemid" data-spec="DOM4" class="externalDFN">systemId</a></code>
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   772
                is not the empty string then append the following, in the order listed, to <var>markup</var>:
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   773
                <ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   774
                    <li>"<code> </code>" (U+0020 SPACE);
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   775
                    <li>"<code>"</code>" (U+0022 QUOTATION MARK);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   776
                    <li>The value of the <var>node</var>'s
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   777
                        <code><a title="dom-documenttype-systemid" data-spec="DOM4" class="externalDFN">systemId</a></code>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   778
                        attribute;
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   779
                    <li>"<code>"</code>" (U+0022 QUOTATION MARK).
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   780
                </ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   781
            </li>
47
1920f7b853a1 Fix bug 23936: [LC Comment] Source reference to DOM L2 Core
travil
parents: 46
diff changeset
   782
            <!-- Removing internalSubset serialization steps as this property is not supported by DOM4. Also,
1920f7b853a1 Fix bug 23936: [LC Comment] Source reference to DOM L2 Core
travil
parents: 46
diff changeset
   783
                optional requirements don't help improve interoperability:
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   784
            <li>Optional: if the <var>node</var> has an (historical)
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   785
                <code><a title="ID-Core-DocType-internalSubset" data-spec="DOM3" class="externalDFN">internalSubset</a></code>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   786
                and the
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   787
                <code><a title="ID-Core-DocType-internalSubset" data-spec="DOM3" class="externalDFN">internalSubset</a></code>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   788
                attribute's value is a non-empty string, then append the following,
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   789
                in the order listed, to <var>markup</var>:
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   790
                <ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   791
                    <li>"<code> </code>" (U+0020 SPACE);
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   792
                    <li>"<code>[</code>" (U+005B LEFT SQUARE BRACKET);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   793
                    <li>The value of the <var>node</var>'s
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   794
                        <code><a title="ID-Core-DocType-internalSubset" data-spec="DOM3" class="externalDFN">internalSubset</a></code>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   795
                        attribute;
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   796
                    <li>"<code>]</code>" (U+005D RIGHT SQUARE BRACKET);
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   797
                </ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   798
                <p class=note>A <var>node</var> belonging to an
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   799
                   <a title="html-document" data-spec="DOM4" class="externalDFN">HTML document</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   800
                   will never have an
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   801
                   <code><a title="ID-Core-DocType-internalSubset" data-spec="DOM3" class="externalDFN">internalSubset</a></code>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   802
                   because any <code><a title="ID-Core-DocType-internalSubset" data-spec="DOM3" class="externalDFN">internalSubset</a></code>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   803
                   markup is ignored by the parser.</p>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   804
            </li>
47
1920f7b853a1 Fix bug 23936: [LC Comment] Source reference to DOM L2 Core
travil
parents: 46
diff changeset
   805
            -->
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   806
            <li>Append "<code>&gt;</code>" (U+003E GREATER-THAN SIGN) to <var>markup</var>.
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   807
            <li>Return the value of <var>markup</var>.
16
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   808
        </ol>
809c9f8a41a9 Factored the DOCTYPE serialization algorithm to additionally support HTML docs
travil
parents: 15
diff changeset
   809
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   810
        <p>To <dfn title="concept-record-namespace-info">record the namespace information</dfn> for an
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   811
            <code><a title="element" data-spec="DOM4" class="externalDFN">Element</a></code> <var>element</var>, given a
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   812
            <a title="concept-namespace-prefix-map">namespace prefix map</a> <var>map</var>, an
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   813
            <var>element prefixes list</var> (initially empty), and a <var>duplicate prefix
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   814
            definition</var> reference, the user agent must run the following steps:
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   815
        <ol>
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   816
            <li>Let <var>default namespace attr value</var> be <code>null</code>.
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   817
            <li><dfn title="record-namespace-loop">Main</dfn>: For each <a title="concept-attribute" data-spec="DOM4" class="externalDFN">attribute</a>
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   818
                <var>attr</var> in <var>element</var>'s
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   819
                <code><a title="dom-element-attributes" data-spec="DOM4" class="externalDFN">attributes</a></code>,
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   820
                in the order they are specified in the <var>element</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   821
                <a title="dom-element-attributes" data-spec="DOM4" class="externalDFN">attribute list</a>:
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   822
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   823
                <p class="note">The following conditional steps add namespace prefixes
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   824
                    into the <var>element prefixes list</var> and add or replace them in the <var>map</var>.
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   825
                    Only attributes in the <a title="xmlns-ns">XMLNS namespace</a> are
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   826
                    considered (e.g., attributes made to look like namespace declarations via
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   827
                    <code><a title="dom-element-setattribute" data-spec="DOM4"
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   828
                    class="externalDFN">setAttribute</a>(<em>"xmlns:pretend-prefix"</em>,
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   829
                    <em>"pretend-namespace"</em>)</code> are not included).</p>
61
679549231021 Fix bugs found by HTML validator
travil
parents: 59
diff changeset
   830
            <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   831
                <li>Let <var>attribute namespace</var> be the value of <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   832
                    <code><a title="dom-attr-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   833
                    value.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   834
                <li>Let <var>attribute prefix</var> be the value of <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   835
                        <code><a title="dom-attr-prefix" data-spec="DOM4" class="externalDFN">prefix</a></code>.
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   836
                <li>If the <var>attribute namespace</var> is the <a title="xmlns-ns">XMLNS namespace</a>, then:
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   837
                <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   838
                    <li>If <var>attribute prefix</var> is <code>null</code>, then <var>attr</var> is a
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   839
                        default namespace declaration. Set the <var>default namespace attr value</var> to
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   840
                        <var>attr</var>'s <code><a title="dom-attr-value" data-spec="DOM4"
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   841
                        class="externalDFN">value</a></code> and stop running these steps, returning to
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   842
                        <a title="record-namespace-loop">Main</a> to visit the next attribute.
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   843
                    <li>Otherwise, the <var>attribute prefix</var> is not <code>null</code> and <var>attr</var>
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   844
                        is a namespace prefix definition. Run the following steps:
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   845
                    <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   846
                        <li>Let <var>prefix definition</var> be the value of <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   847
                            <code><a title="dom-attr-localname" data-spec="DOM4" class="externalDFN">localName</a></code>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   848
                        <li>Let <var>namespace definition</var> be the value of <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   849
                            <code><a title="dom-attr-value" data-spec="DOM4" class="externalDFN">value</a></code>.
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   850
                        <li>If a key matching the value of <var>namespace definition</var> already exists in
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   851
                            <var>map</var>, and the key's value matches <var>prefix definition</var>, then
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   852
                            this is a duplicate namespace prefix definition. Set the value of <var>duplicate
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   853
                            prefix definition</var> to <var>prefix definition</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   854
                        <li>Otherwise, if the key matching the value of <var>namespace definition</var> already
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   855
                            exists in <var>map</var>, but the key's value does not match <var>prefix definition</var>,
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   856
                            then update the key's value to be <var>prefix definition</var>.
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   857
                        <li>Otherwise, no key matching the value of <var>namespace definition</var> exists;
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   858
                            append to <var>map</var> a new key <var>namespace definition</var>
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   859
                            whose key value is the <var>prefix definition</var>.
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   860
                        <li>Append the value of <var>prefix definition</var> to <var>element prefixes list</var>.
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   861
                    </ol>
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   862
                </ol>
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   863
            </ol>
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   864
            <li>Return the value of <var>default namespace attr value</var>.
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   865
        </ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   866
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   867
        <p>To <dfn title="concept-generate-prefix">generate a prefix</dfn> given a
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   868
            <a title="concept-namespace-prefix-map">namespace prefix map</a> <var>map</var>, a
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   869
            string <var>new namespace</var>, and a reference to a
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   870
            <a title="concept-generated-prefix">generated namespace prefix index</a> <var>prefix
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   871
            index</var>, the user agent must run the following steps:
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   872
        <ol>
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   873
            <li>Let <var>generated prefix</var> be the concatenation of the string "<code>ns</code>" and
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   874
                the current numerical value of <var>prefix index</var>.
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   875
            <li>Let the value of <var>prefix index</var> be incremented by one.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   876
            <li>Append to <var>map</var> a new key <var>new namespace</var> whose key value is the
38
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   877
                <var>generated prefix</var>.
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   878
            <li>Return the value of <var>generated prefix</var>.
fb9edcfb8f5f Rewrite of the Element serializing XML serializer algorithm. Should be much closer
travil
parents: 37
diff changeset
   879
        </ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   880
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
   881
        <p>The <dfn title="concept-serialize-xml-attributes">XML serialization of the attributes</dfn>
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   882
            of an <code><a title="concept-element" data-spec="DOM4" class="externalDFN">Element</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   883
            <var>element</var> together with a <a title="concept-namespace-prefix-map">namespace prefix
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   884
            map</a> <var>map</var>, a <a title="concept-generated-prefix">generated prefix index</a>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   885
            <var>prefix index</var> reference, a flag <var>ignore namespace definition attribute</var>, a
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   886
            <var>duplicate prefix definition</var> value, and a flag <var>require well-formed</var>,
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   887
            is the result of the following algorithm:
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   888
        <ol>
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   889
            <li>Let <var>result</var> be the empty string.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   890
            <li>Let <var>localname set</var> be a new empty
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   891
                <dfn title="concept-namespace-localname-set">namespace localname set</dfn>. This <var>localname
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   892
                set</var> will contain tuples of unique attribute
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   893
                <code><a title="dom-attr-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   894
                and <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   895
                pairs, and is populated as each <var>attr</var> is processed.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   896
                <span class="note">This set is used to [optionally] enforce the well-formed constraint that an
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   897
                element cannot have two attributes with the same
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   898
                <code><a title="dom-attr-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   899
                and <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>.
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   900
                This can occur when two otherwise identical attributes on the same element differ only by their
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   901
                prefix values.</span>
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   902
            <li><dfn title="serialize-attributes-loop">Main</dfn>: For each <a title="concept-attribute" data-spec="DOM4" class="externalDFN">attribute</a>
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   903
                <var>attr</var> in <var>element</var>'s
55
49c41bbec2b4 Consistency pass--ensure all external refs that are proper attributes are linked
travil
parents: 54
diff changeset
   904
                <code><a title="dom-element-attributes" data-spec="DOM4" class="externalDFN">attributes</a></code>,
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
   905
                in the order they are specified in the <var>element</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   906
                <a title="dom-element-attributes" data-spec="DOM4" class="externalDFN">attribute list</a>:
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   907
            <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   908
                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   909
                    <code>true</code>), and the <var>localname set</var> contains a tuple whose values match those
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   910
                    of a new tuple consisting of <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   911
                    <code><a title="dom-attr-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   912
                    attribute and <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   913
                    attribute, then <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   914
                    <var>attr</var> would fail to produce a well-formed element serialization.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   915
                <li>Create a new tuple consisting of <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   916
                    <code><a title="dom-attr-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   917
                    attribute and <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   918
                    attribute, and add it to the <var>localname set</var>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   919
                <li>Let <var>attribute namespace</var> be the value of <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   920
                    <code><a title="dom-attr-namespaceuri" data-spec="DOM4" class="externalDFN">namespaceURI</a></code>
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   921
                    value.
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   922
                <!-- Check for an unregistered attribute namespace, and if so, serialize a definition for it -->
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   923
                <li>Let <var>candidate prefix</var> be <code>null</code>.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   924
                <li>If <var>attribute namespace</var> is not <code>null</code>, then run these sub-steps:
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   925
                <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   926
                    <li>If the value of <var>attribute namespace</var> is the
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   927
                        <a title="xmlns-ns">XMLNS namespace</a> and either the <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   928
                        <code><a title="dom-attr-prefix" data-spec="DOM4" class="externalDFN">prefix</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   929
                        is <code>null</code> and the <var>ignore namespace definition
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   930
                        attribute</var> flag is <code>true</code> or the <var>attr</var>'s
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   931
                        <code><a title="dom-attr-prefix" data-spec="DOM4" class="externalDFN">prefix</a></code>
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   932
                        is not <code>null</code> and the <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   933
                        <code><a title="dom-attr-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   934
                        matches the value of <var>duplicate prefix definition</var>, then stop running
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   935
                        these steps and goto <a title="serialize-attributes-loop">Main</a> to visit the next attribute.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   936
                    <li>Otherwise, if there exists a key in <var>map</var> that matches the value of <var>attribute
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   937
                        namespace</var>, then let <var>candidate prefix</var> be that key's value from the
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   938
                        <var>map</var>.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   939
                    <li>Otherwise, there is no key matching <var>attribute namespace</var> in <var>map</var> and
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   940
                        the <var>attribute namespace</var> is not the <a title="xmlns-ns">XMLNS namespace</a>.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   941
                        Run these steps:
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   942
                    <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   943
                        <li>Let <var>candidate prefix</var> be the result of
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   944
                            <a title="concept-generate-prefix">generating a prefix</a> providing <var>map</var>,
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   945
                            <var>attribute namespace</var>, and <var>prefix index</var> as input.
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   946
                        <li>Append the following to <var>result</var>, in the order listed:
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   947
                        <ol>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   948
                            <li>"<code> </code>" (U+0020 SPACE);
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   949
                            <li>The string "<code>xmlns:</code>";
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   950
                            <li>The value of <var>candidate prefix</var>;
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   951
                            <li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   952
                            <li>The result of <a title="concept-serialize-attr-value">serializing an attribute value</a>
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   953
                                given <var>attribute namespace</var> and the
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   954
                                <a title="concept-well-formed">require well-formed</a> flag as input;
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   955
                            <li>"<code>"</code>" (U+0022 QUOTATION MARK).
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   956
                        </ol>
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   957
                    </ol>
18
15a9ba955a3a Expanded the XML Serialization algorithm for Elements (and a sligt enhancement
travil
parents: 17
diff changeset
   958
                </ol>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   959
                <!-- A namespace prefix has been set by this point if it needed to be set -->
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   960
                <li>Append a "<code> </code>" (U+0020 SPACE) to <var>result</var>.
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   961
                <li>If <var>candidate prefix</var> is not <code>null</code>, then append to <var>result</var>
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   962
                    the concatenation of <var>candidate prefix</var> with "<code>:</code>" (U+003A COLON).
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   963
                <!-- Check for well-formed localName -->
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   964
                <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   965
                    <code>true</code>), and this <var>attr</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   966
                    <code><a title="dom-element-localname" data-spec="DOM4" class="externalDFN">localName</a></code>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   967
                    attribute contains the character "<code>:</code>" (U+003A COLON) or does not match the XML
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   968
                    <code>Name</code> production [[XML10]] or equals "<code>xmlns</code>" and <var>attribute
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   969
                    namespace</var> is <code>null</code>, then <a title="concept-algorithm-exception">throw an
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   970
                    exception</a>; the serialization of this <var>attr</var> would not be a well-formed attribute.
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   971
                <!-- Write out the standard attribute -->
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   972
                <li>Append the following strings to <var>result</var>, in the order listed:
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   973
                <ol>
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   974
                    <li>The value of <var>attr</var>'s
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
   975
                        <code><a title="dom-attr-localname" data-spec="DOM4" class="externalDFN">localName</a></code>;
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   976
                    <li>"<code>="</code>" (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   977
                    <li>The result of <a title="concept-serialize-attr-value">serializing an attribute value</a>
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   978
                        given <var>attr</var>'s
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   979
                        <code><a title="concept-attribute-value" data-spec="DOM4" class="externalDFN">value</a></code>
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   980
                        attribute and the <a title="concept-well-formed">require well-formed</a> flag as input;
39
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   981
                    <li>"<code>"</code>" (U+0022 QUOTATION MARK).
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   982
                </ol>
1860a8d798cf Cleanup of the Element and Processing Instruction parts of algorithm, plus some
travil
parents: 38
diff changeset
   983
            </ol>
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   984
            <li>Return the value of <var>result</var>.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
   985
        </ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   986
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   987
        <p>To <dfn title="concept-serialize-attr-value">serialize an attribute value</dfn> given an
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   988
            <var>attribute value</var> and <a title="concept-well-formed">require well-formed</a> flag,
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   989
            the user agent must run the following steps:
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   990
        <ol>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   991
            <li>If the <a title="concept-well-formed">require well-formed</a> flag is set (its value is
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   992
                <code>true</code>), and <var>attribute value</var> contains characters that are not matched
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   993
                by the XML <code>Char</code> production [[XML10]], then
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   994
                <a title="concept-algorithm-exception">throw an exception</a>; the serialization of this
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
   995
                <var>attribute value</var> would fail to produce a well-formed element serialization.
42
fa768c710fba Algorithm Polish (variable re-names, prose clean-up and clarifying notes here and there).
travil
parents: 41
diff changeset
   996
            <li>If <var>attribute value</var> is <code>null</code>, then return the empty string.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
   997
            <li>Otherwise, <var>attribute value</var> is a string. Return the value of
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
   998
                <var>attribute value</var>, first replacing any occurrences of the following:
41
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
   999
            <ol>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1000
                <li>"<code>&quot;</code>" with "<code>&amp;quot;</code>"
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1001
                <li>"<code>&amp;</code>" with "<code>&amp;amp;</code>"
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1002
                <li>"<code>&lt;</code>" with "<code>&amp;lt;</code>"
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1003
                <li>"<code>&gt;</code>" with "<code>&amp;gt;</code>"
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1004
            </ol>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1005
            <p class="note">This matches behavior present in browsers, and goes above
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1006
                and beyond the grammar requirement in the XML specification's AttValue
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1007
                production [[XML10]] by also replacing "<code>&gt;</code>" characters.</p>
f9b5a818ef99 Another update to the Element/Attribute serialization algorithm to fix recent
travil
parents: 40
diff changeset
  1008
        </ol>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1009
    </section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1010
</section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1011
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1012
<section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1013
    <h1>The <code>DOMParser</code> interface</h1>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1014
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1015
<pre class=extraidl>enum <span class=idlInterfaceID>SupportedType</span> {
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1016
    "text/html",
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1017
    "text/xml",
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1018
    "application/xml",
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1019
    "application/xhtml+xml",
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1020
    "image/svg+xml"
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1021
};</pre>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1022
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1023
    <p>The <dfn title="dom-domparser"><code>DOMParser()</code></dfn> constructor
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1024
    must return a new <code>DOMParser</code> object.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1025
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1026
    <dl class="idl" title="[Constructor] interface DOMParser">
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
  1027
        <dt>[NewObject] Document parseFromString(DOMString str, SupportedType type)</dt>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1028
        <dd>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1029
            <p>The
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1030
            <dfn title="dom-domparser-parsefromstring"><code>parseFromString(<var>str</var>, <var>type</var>)</code></dfn>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1031
            method must run these steps, depending on <var>type</var>:
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1032
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1033
            <dl class=switch>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1034
                <dt>"<code>text/html</code>"
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1035
                <dd>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1036
                <p>Parse <var>str</var> with an
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1037
                <code><a data-spec="HTML5" title="html-parser" class="externalDFN">HTML parser</a></code>, and return the newly
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1038
                created <a title="concept-document" data-spec="DOM4" class="externalDFN">document</a>.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1039
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1040
                <p>The <a data-spec="HTML5" title="scripting-flag" class="externalDFN">scripting flag</a> must be set to
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1041
                "disabled".
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1042
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1043
                <p class=note><code><a data-spec="HTML5" title="meta" class="externalDFN">meta</a></code> elements are not
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1044
                taken into account for the encoding used, as a Unicode stream is passed into
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1045
                the parser.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1046
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1047
                <p class=note><code><a data-spec="HTML5" title="script" class="externalDFN">script</a></code> elements get marked
62
2ecb5ad8807c Fix bugs found by Link Checker
travil
parents: 61
diff changeset
  1048
                unexecutable and the contents of <code><a data-spec="HTML5" title="the-noscript-element" class="externalDFN">noscript</a></code>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1049
                get parsed as markup.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1050
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1051
                <dt>"<code>text/xml</code>"
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1052
                <dt>"<code>application/xml</code>"
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1053
                <dt>"<code>application/xhtml+xml</code>"
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1054
                <dt>"<code>image/svg+xml</code>"
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1055
                <dd>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1056
                <ol>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1057
                    <li>Parse <var>str</var> with a namespace-enabled
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1058
                    <code><a data-spec="HTML5" title="xml-parser" class="externalDFN">XML parser</a></code>.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1059
66
8dbd8dbdefdc Fix bug 25582 Two short questions
travil@microsoft.com
parents: 65
diff changeset
  1060
                    <p class="note">For all XHTML <code><a data-spec="HTML5" title="script" class="externalDFN">script</a></code>
8dbd8dbdefdc Fix bug 25582 Two short questions
travil@microsoft.com
parents: 65
diff changeset
  1061
                        elements parsed using the <code><a data-spec="HTML5" title="xml-parser" class="externalDFN">XML parser</a></code>,
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1062
                        the equivalent of the <a data-spec="HTML5" title="scripting-flag" class="externalDFN">scripting flag</a> must
66
8dbd8dbdefdc Fix bug 25582 Two short questions
travil@microsoft.com
parents: 65
diff changeset
  1063
                        be set to "disabled".</p>
8dbd8dbdefdc Fix bug 25582 Two short questions
travil@microsoft.com
parents: 65
diff changeset
  1064
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1065
                    <li>If the previous step didn't return an error, return the newly
59
97f9c81f0990 Fix bug 25303
travil
parents: 58
diff changeset
  1066
                    created <a title="concept-document" data-spec="DOM4" class="externalDFN">document</a>.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1067
56
b9d2104e193a Revert changelist 23 (0890bba5b66a) -- sigh.
travil
parents: 55
diff changeset
  1068
                    <!-- This seemed like a good idea, but isn't web compatible, unfortunately.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1069
                    <li>Otherwise, throw a
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1070
                    <code><a data-spec="DOM4" title="domexception" class="externalDFN">DOMException</a></code>
56
b9d2104e193a Revert changelist 23 (0890bba5b66a) -- sigh.
travil
parents: 55
diff changeset
  1071
                    with name <code>SyntaxError</code>. -->
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1072
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1073
                    <li>Let <var>document</var> be a newly-created
57
d799e62378b7 Sync up with Living Specification changes: Document rather than XMLDocument
travil
parents: 56
diff changeset
  1074
                    <a data-spec="DOM4" title="xml-document" class="externalDFN">XML Document</a>.
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1075
                    <span class="note">The <var>document</var> will use the
57
d799e62378b7 Sync up with Living Specification changes: Document rather than XMLDocument
travil
parents: 56
diff changeset
  1076
                    <code><a data-spec="DOM4" title="document" class="externalDFN">Document</a></code> interface
d799e62378b7 Sync up with Living Specification changes: Document rather than XMLDocument
travil
parents: 56
diff changeset
  1077
                    rather than the <code><a data-spec="DOM4" title="xmldocument" class="externalDFN">XMLDocument</a></code>
d799e62378b7 Sync up with Living Specification changes: Document rather than XMLDocument
travil
parents: 56
diff changeset
  1078
                    interface.</span>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1079
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1080
                    <li>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1081
                    <p>Let <var>root</var> be a new
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1082
                    <code><a title="element" data-spec="DOM4" class="externalDFN">Element</a></code>, with its
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1083
                    <a title="concept-element-local-name" data-spec="DOM4" class="externalDFN">local name</a>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1084
                    set to "<code>parsererror</code>" and its
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1085
                    <a title="concept-element-namespace" data-spec="DOM4" class="externalDFN">namespace</a>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1086
                    set to
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1087
                    "<code>http://www.mozilla.org/newlayout/xml/parsererror.xml</code>".
56
b9d2104e193a Revert changelist 23 (0890bba5b66a) -- sigh.
travil
parents: 55
diff changeset
  1088
                    <!-- see https://bugzilla.mozilla.org/show_bug.cgi?id=45566 -->
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1089
                    <p>At this point user agents may
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1090
                    <a data-spec="DOM4" title="concept-node-append" class="externalDFN">append</a> nodes
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1091
                    to <var>root</var>, for example to describe the nature of the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1092
                    error.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1093
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1094
                    <li><a data-spec="DOM4" title="concept-node-append" class="externalDFN">Append</a>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1095
                    <var>root</var> to <var>document</var>.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1096
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
  1097
                    <li>Return the value of <var>document</var>.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1098
                </ol>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1099
            </dl>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1100
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1101
            <p>In any case, the returned
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1102
            <a title="concept-document" data-spec="DOM4" class="externalDFN">document</a>'s
61
679549231021 Fix bugs found by HTML validator
travil
parents: 59
diff changeset
  1103
            <a title="concept-document-content-type" data-spec="DOM4" class="externalDFN">content type</a>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1104
            must be the <var>type</var> argument. Additionally, the
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1105
            <a title="concept-document" data-spec="DOM4" class="externalDFN">document</a> must have a
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1106
            <a title="concept-document-url" data-spec="DOM4" class="externalDFN">URL</a> value equal to
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1107
            the URL of the
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1108
            <a title="active-document" data-spec="HTML5" class="externalDFN">active document</a>, a
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1109
            <a title="location" data-spec="HTML5" class="externalDFN">location</a> value of <code>null</code>.
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1110
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1111
            <p class=note>The returned
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1112
            <a title="concept-document" data-spec="DOM4" class="externalDFN">document</a>'s
61
679549231021 Fix bugs found by HTML validator
travil
parents: 59
diff changeset
  1113
            <a title="concept-document-encoding" data-spec="DOM4" class="externalDFN">encoding</a> is
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1114
            the default, UTF-8.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1115
        </dd>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1116
    </dl>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1117
</section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1118
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1119
<section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1120
    <h1>The <code>XMLSerializer</code> interface</h1>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1121
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1122
    <p>The <dfn title="dom-xmlserializer"><code>XMLSerializer()</code></dfn>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1123
    constructor must return a new <code>XMLSerializer</code> object.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1124
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1125
    <dl class="idl" title="[Constructor] interface XMLSerializer">
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1126
        <dt>DOMString serializeToString(Node root)</dt>
0
f39b5b437d3d The beginning.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents:
diff changeset
  1127
65
dc7083c47f77 Fix bug 25565: Another small bugs
travil@microsoft.com
parents: 62
diff changeset
  1128
        <dd>The <dfn title="dom-xmlserializer-serializetostring"><code>serializeToString(<var>root</var>)</code></dfn>
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@microsoft.com
parents: 66
diff changeset
  1129
        method must <a title="concept-serialize-xml">produce an XML serialization</a> of <var>root</var> passing
50
f3d96628e2b5 Fix bug 25168: Should XML Serialization be allowed to produce invalid XML?
travil
parents: 49
diff changeset
  1130
        a value of <code>false</code> for the <a title="concept-well-formed">require well-formed</a> parameter, and return the result.</dd>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1131
    </dl>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1132
</section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1133
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1134
<section>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1135
    <h1>Extensions to the <code><a title="element" data-spec="DOM4" class="externalDFN">Element</a></code> interface</h1>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1136
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1137
    <dl class="idl" title="partial interface Element">
11
ed0d76e9894d Processing WHATWG checkin:
travil
parents: 10
diff changeset
  1138
        <dt>[TreatNullAs=EmptyString] attribute DOMString innerHTML</dt>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1139
        <dd>
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1140
            <p>The <dfn title="dom-element-innerhtml"><code>innerHTML</code></dfn> IDL
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1141
            attribute represents the markup of the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1142
            <code><a title="element" data-spec="DOM4" class="externalDFN">Element</a></code>'s contents.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1143
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1144
            <dl class=domintro>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1145
                <!--doc.ih
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1146
                <dt><var>document</var> . <code title="dom-document-innerhtml">innerHTML</code> [ = <var>value</var> ]
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1147
                <dd>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1148
                <p>Returns a fragment of HTML or XML that represents the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1149
                <code><a title="document" data-spec="DOM4" class="externalDFN">Document</a></code>.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1150
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1151
                <p>Can be set, to replace the
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1152
                <code><a title="document" data-spec="DOM4" class="externalDFN">Document</a></code>'s contents with the result of
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1153
                parsing the given string.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1154
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1155
                <p>In the case of an <a title="xml-document" data-spec="DOM4" class="externalDFN">XML document</a>,
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1156
                will throw an
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1157
                <code><a data-spec="DOM4" title="domexception" class="externalDFN">DOMException</a></code> with name <code>InvalidStateError</code>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1158
                if the <code><a title="document" data-spec="DOM4" class="externalDFN">Document</a></code> cannot be serialized
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1159
                to XML, and a
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1160
                <code><a data-spec="DOM4" title="domexception" class="externalDFN">DOMException</a></code> with name <code>SyntaxError</code>
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1161
                if the given string is not well-formed.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1162
                -->
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1163
34
f5458f389274 Applied consistent quoting around title attributes and lowercased all refs to
tleithea
parents: 33
diff changeset
  1164
                <dt><var>element</var> . <code title="dom-element-innerhtml">innerHTML</code> [ = <var>value</var> ]
1
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1165
                <dd>
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1166
                <p>Returns a fragment of HTML or XML that represents the element's
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1167
                contents.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1168
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1169
                <p>Can be set, to replace the contents of the element with nodes
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1170
                parsed from the given string.
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1171
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1172
                <p>In the case of an <a title="xml-document" data-spec="DOM4" class="externalDFN">XML document</a>,
5cb52744fe44 Conversion to ReSpec and W3C editor's draft template.
travil@travil1.wingroup.windeploy.ntdev.microsoft.com
parents: 0
diff changeset
  1173
                will throw a
67
8188d1e767f6 Editorial: remove trailing whitespace
travil@mi&#