@@ -244,7 +244,7 @@ <h2>Parsing</h2>
244
244
< h2 > Serializing</ h2 >
245
245
< p > The following steps form the
246
246
< dfn title ="concept-fragment-serializing-algorithm "> fragment serializing algorithm</ dfn > ,
247
- whose arguments are a < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a >
247
+ whose arguments are a < code > < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > </ code >
248
248
< var > node</ var > and a flag < dfn title ="concept-well-formed "> require well-formed</ dfn > .
249
249
250
250
< ol >
@@ -263,13 +263,13 @@ <h2>Serializing</h2>
263
263
</ ol >
264
264
265
265
< p > To produce an < dfn title ="concept-serialize-html "> HTML serialization</ dfn > of a
266
- < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > < var > node</ var > , the user agent
266
+ < code > < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > </ code > < var > node</ var > , the user agent
267
267
must run the
268
268
< a data-spec ="HTML5 " title ="html-fragment-serialization-algorithm " class ="externalDFN "> HTML
269
269
fragment serialization algorithm</ a > [[!HTML5]] on < var > node</ var > and return the string produced.
270
270
271
271
< p > To produce an < dfn title ="concept-serialize-xml "> XML serialization</ dfn > of a
272
- < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > < var > node</ var > given a
272
+ < code > < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > </ code > < var > node</ var > given a
273
273
flag < var > require well-formed</ var > , run the following steps:
274
274
< ol >
275
275
< li > Let < dfn title ="concept-context-namespace "> context namespace</ dfn > be < code > null</ code > .
@@ -326,11 +326,11 @@ <h2>Serializing</h2>
326
326
elements in the < a title ="html-ns "> HTML namespace</ a > that contain no child nodes are serialized
327
327
with an explicit begin and end tag rather than using the self-closing tag syntax [[XML10]].
328
328
329
- < p class ="note "> Per [[DOM4]], < a title ="interface-attr " data-spec ="DOM4 " class ="externalDFN "> Attr</ a >
330
- objects are not < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > s , and thus cannot
329
+ < p class ="note "> Per [[DOM4]], < code > < a title ="interface-attr " data-spec ="DOM4 " class ="externalDFN "> Attr</ a > </ code >
330
+ objects do not inherit from < code > < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > </ code > , and thus cannot
331
331
be serialized by the < a title ="concept-xml-serialization-algorithm "> XML serialization algorithm</ a > .
332
- An attempt to serialize an < a title ="interface-attr " data-spec ="DOM4 " class ="externalDFN "> Attr</ a >
333
- object will result in a TypeError exception [[WEBIDL]].
332
+ An attempt to serialize an < code > < a title ="interface-attr " data-spec ="DOM4 " class ="externalDFN "> Attr</ a > </ code >
333
+ object will result in a < code > TypeError</ code > exception [[WEBIDL]].
334
334
335
335
< p > To run the < dfn title ="concept-xml-serialization-algorithm "> XML serialization algorithm</ dfn > on
336
336
a < var > node</ var > given a < a title ="concept-context-namespace "> context namespace</ a >
@@ -383,9 +383,9 @@ <h2>Serializing</h2>
383
383
namespace definition attribute</ var > to < code > true</ code > .
384
384
< li > If < var > ns</ var > is the < a title ="xml-ns "> XML namespace</ a > , then let < var > qualified name</ var >
385
385
be the concatenation of the string "< code > xml:</ code > " and the value of < var > node</ var > 's
386
- < a title ="dom-element-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > .
386
+ < code > < a title ="dom-element-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code > .
387
387
< li > Otherwise, let < var > qualified name</ var > be the value of < var > node</ var > 's
388
- < a title ="dom-element-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > .
388
+ < code > < a title ="dom-element-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code > .
389
389
< span class ="note "> The < var > node</ var > 's prefix is always dropped.</ span >
390
390
< li > Append the value of < var > qualified name</ var > to < var > markup</ var > .
391
391
</ ol >
@@ -530,12 +530,12 @@ <h2>Serializing</h2>
530
530
< li > If < var > ns</ var > is the < a title ="html-ns "> HTML namespace</ a > , and the < var > node</ var > 's
531
531
< code > < a title ="dom-element-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code >
532
532
matches the string "< code > template</ code > ", then this is a
533
- < a title ="the-template-element " data-spec ="HTML5 " class ="externalDFN "> template</ a > element.
533
+ < code > < a title ="the-template-element " data-spec ="HTML5 " class ="externalDFN "> template</ a > </ code > element.
534
534
Append to < var > markup</ var > the result of running the
535
535
< a title ="concept-xml-serialization-algorithm "> XML serialization algorithm</ a > on the
536
536
< a title ="the-template-element " data-spec ="HTML5 " class ="externalDFN "> template</ a > element's
537
537
< a title ="template-contents " data-spec ="HTML5 " class ="externalDFN "> template contents</ a >
538
- (a < a title ="interface-documentfragment " data-spec ="DOM4 " class ="externalDFN "> DocumentFragment</ a > ),
538
+ (a < code > < a title ="interface-documentfragment " data-spec ="DOM4 " class ="externalDFN "> DocumentFragment</ a > </ code > ),
539
539
providing the value of < var > inherited ns</ var > for the
540
540
< a title ="concept-context-namespace "> context namespace</ a > ,
541
541
< var > map</ var > for the < a title ="concept-namespace-prefix-map "> namespace prefix map</ a > ,
@@ -569,8 +569,8 @@ <h2>Serializing</h2>
569
569
< dd >
570
570
< p > If the < a title ="concept-well-formed "> require well-formed</ a > flag is set (its value is
571
571
< code > true</ code > ), and this < var > node</ var > has no
572
- < a title ="dom-document-documentelement " data-spec ="HTML5 " class ="externalDFN "> documentElement</ a >
573
- (the < a title ="dom-document-documentelement " data-spec ="HTML5 " class ="externalDFN "> documentElement</ a >
572
+ < code > < a title ="dom-document-documentelement " data-spec ="HTML5 " class ="externalDFN "> documentElement</ a > </ code >
573
+ (the < code > < a title ="dom-document-documentelement " data-spec ="HTML5 " class ="externalDFN "> documentElement</ a > </ code >
574
574
attribute's value is < code > null</ code > ), then < a title ="concept-algorithm-exception "> throw an
575
575
exception</ a > ; the serialization of this < var > node</ var > would not be a well-formed document.
576
576
< p > Otherwise, run the following steps:
@@ -579,9 +579,9 @@ <h2>Serializing</h2>
579
579
< li > Append to < var > serialized document</ var > the string produced by running the steps to
580
580
< a title ="concept-serialize-doctype "> produce a DocumentType serialization</ a >
581
581
of < var > node</ var > 's
582
- < a title ="dom-document-doctype " data-spec ="HTML5 " class ="externalDFN "> doctype</ a >
582
+ < code > < a title ="dom-document-doctype " data-spec ="HTML5 " class ="externalDFN "> doctype</ a > </ code >
583
583
attribute provided the < var > require well-formed</ var > flag if < var > node</ var > 's
584
- < a title ="dom-document-doctype " data-spec ="HTML5 " class ="externalDFN "> doctype</ a >
584
+ < code > < a title ="dom-document-doctype " data-spec ="HTML5 " class ="externalDFN "> doctype</ a > </ code >
585
585
attribute is not < code > null</ code > .
586
586
< li > For each
587
587
< a title ="concept-tree-child " data-spec ="DOM4 " class ="externalDFN "> child</ a > of
@@ -706,7 +706,7 @@ <h2>Serializing</h2>
706
706
</ dl >
707
707
708
708
< p > To < dfn title ="concept-serialize-doctype "> produce a DocumentType serialization</ dfn > of a
709
- < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > < var > node</ var > , given a
709
+ < code > < a title ="node " data-spec ="DOM4 " class ="externalDFN "> Node</ a > </ code > < var > node</ var > , given a
710
710
< a title ="concept-well-formed "> require well-formed</ a > flag, the user agent must return
711
711
the result of the following algorithm:</ p >
712
712
@@ -796,15 +796,15 @@ <h2>Serializing</h2>
796
796
</ ol >
797
797
798
798
< p > To < dfn title ="concept-record-namespace-info "> record the namespace information</ dfn > for an
799
- < a title ="element " data-spec ="DOM4 " class ="externalDFN "> Element</ a > < var > element</ var > , given a
799
+ < code > < a title ="element " data-spec ="DOM4 " class ="externalDFN "> Element</ a > </ code > < var > element</ var > , given a
800
800
< a title ="concept-namespace-prefix-map "> namespace prefix map</ a > < var > map</ var > , an
801
801
< var > element prefixes list</ var > (initially empty), and a < var > duplicate prefix
802
802
definition</ var > reference, the user agent must run the following steps:
803
803
< ol >
804
804
< li > Let < var > default namespace attr value</ var > be < code > null</ code > .
805
805
< li > For each < a title ="concept-attribute " data-spec ="DOM4 " class ="externalDFN "> attribute</ a >
806
806
< var > attr</ var > in < var > element</ var > 's
807
- < a title ="concept -element-attribute " data-spec ="DOM4 " class ="externalDFN "> attributes</ a > ,
807
+ < code > < a title ="dom -element-attributes " data-spec ="DOM4 " class ="externalDFN "> attributes</ a > </ code > ,
808
808
in order:
809
809
< ol >
810
810
< p class ="note "> The following conditional steps add namespace prefixes
@@ -815,24 +815,24 @@ <h2>Serializing</h2>
815
815
class ="externalDFN "> setAttribute</ a > (< em > "xmlns:pretend-prefix"</ em > ,
816
816
< em > "pretend-namespace"</ em > )</ code > are not included).</ p >
817
817
< li > Let < var > attribute namespace</ var > be the < var > attr</ var > 's
818
- < a title ="dom-attribute-namespaceuri " data-spec ="DOM4 " class ="externalDFN "> namespaceURI</ a >
818
+ < code > < a title ="dom-attribute-namespaceuri " data-spec ="DOM4 " class ="externalDFN "> namespaceURI</ a > </ code >
819
819
value.
820
820
< li > Let < var > attribute prefix</ var > be the value of < var > attr</ var > 's
821
- < a title ="dom-attribute-prefix " data-spec ="DOM4 " class ="externalDFN "> prefix</ a > .
821
+ < code > < a title ="dom-attribute-prefix " data-spec ="DOM4 " class ="externalDFN "> prefix</ a > </ code > .
822
822
< li > If the < var > attribute namespace</ var > is the < a title ="xmlns-ns "> XMLNS namespace</ a > , then:
823
823
< ol >
824
824
< li > If < var > attribute prefix</ var > is < code > null</ code > , then < var > attr</ var > is a
825
825
default namespace declaration. Set the < var > default namespace attr value</ var > to
826
- < var > attr</ var > 's < a title ="dom-attribute-value " data-spec ="DOM4 "
827
- class ="externalDFN "> value</ a > and stop running these steps, returning to the
826
+ < var > attr</ var > 's < code > < a title ="dom-attribute-value " data-spec ="DOM4 "
827
+ class ="externalDFN "> value</ a > </ code > and stop running these steps, returning to the
828
828
top of the loop to visit the next attribute.
829
829
< li > Otherwise, the < var > attribute prefix</ var > is not < code > null</ code > and < var > attr</ var >
830
830
is a namespace prefix definition. Run the following steps:
831
831
< ol >
832
832
< li > Let < var > prefix definition</ var > be the value of < var > attr</ var > 's
833
- < a title ="dom-attribute-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > .
833
+ < code > < a title ="dom-attribute-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code > .
834
834
< li > Let < var > namespace definition</ var > be the value of < var > attr</ var > 's
835
- < a title ="dom-attribute-value " data-spec ="DOM4 " class ="externalDFN "> value</ a > .
835
+ < code > < a title ="dom-attribute-value " data-spec ="DOM4 " class ="externalDFN "> value</ a > </ code > .
836
836
< li > If a key matching the value of < var > namespace definition</ var > already exists in
837
837
< var > map</ var > , and the key's value matches < var > prefix definition</ var > , then
838
838
this is a duplicate namespace prefix definition. Set the value of < var > duplicate
@@ -865,7 +865,7 @@ <h2>Serializing</h2>
865
865
</ ol >
866
866
867
867
< p > The < dfn title ="concept-serialize-xml-attributes "> XML serialization of the attributes</ dfn >
868
- of an < a title ="concept-element " data-spec ="DOM4 " class ="externalDFN "> Element</ a >
868
+ of an < code > < a title ="concept-element " data-spec ="DOM4 " class ="externalDFN "> Element</ a > </ code >
869
869
< var > element</ var > together with a < a title ="concept-namespace-prefix-map "> namespace prefix
870
870
map</ a > < var > map</ var > , a < a title ="concept-generated-prefix "> generated prefix index</ a >
871
871
< var > prefix index</ var > reference, a flag < var > ignore namespace definition attribute</ var > , a
@@ -875,15 +875,19 @@ <h2>Serializing</h2>
875
875
< li > Let < var > result</ var > be the empty string.
876
876
< li > Let < var > localname set</ var > be a new empty
877
877
< dfn title ="concept-namespace-localname-set "> namespace localname set</ dfn > . This < var > localname
878
- set</ var > will contain tuples of unique attribute < code > namespaceURI</ code > and < code > localName</ code >
878
+ set</ var > will contain tuples of unique attribute
879
+ < code > < a title ="dom-attribute-namespaceuri " data-spec ="DOM4 " class ="externalDFN "> namespaceURI</ a > </ code >
880
+ and < code > < a title ="dom-element-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code >
879
881
pairs, and is populated as each < var > attr</ var > is processed.
880
882
< span class ="note "> This set is used to [optionally] enforce the well-formed constraint that an
881
- element cannot have two attributes with the same < code > namespaceURI</ code > and < code > localName</ code > .
883
+ element cannot have two attributes with the same
884
+ < code > < a title ="dom-attribute-namespaceuri " data-spec ="DOM4 " class ="externalDFN "> namespaceURI</ a > </ code >
885
+ and < code > < a title ="dom-element-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code > .
882
886
This can occur when two otherwise identical attributes on the same element differ only by their
883
887
prefix values.</ span >
884
888
< li > For each < a title ="concept-attribute " data-spec ="DOM4 " class ="externalDFN "> attribute</ a >
885
889
< var > attr</ var > in < var > element</ var > 's
886
- < a title ="concept -element-attribute " data-spec ="DOM4 " class ="externalDFN "> attributes</ a > ,
890
+ < code > < a title ="dom -element-attributes " data-spec ="DOM4 " class ="externalDFN "> attributes</ a > </ code > ,
887
891
in order:
888
892
< ol >
889
893
< li > If the < a title ="concept-well-formed "> require well-formed</ a > flag is set (its value is
@@ -898,20 +902,20 @@ <h2>Serializing</h2>
898
902
attribute and < code > < a title ="dom-element-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code >
899
903
attribute, and add it to the < var > localname set</ var > .
900
904
< li > Let < var > attribute namespace</ var > be the < var > attr</ var > 's
901
- < a title ="dom-attribute-namespaceuri " data-spec ="DOM4 " class ="externalDFN "> namespaceURI</ a >
905
+ < code > < a title ="dom-attribute-namespaceuri " data-spec ="DOM4 " class ="externalDFN "> namespaceURI</ a > </ code >
902
906
value.
903
907
<!-- Check for an unregistered attribute namespace, and if so, serialize a definition for it -->
904
908
< li > Let < var > candidate prefix</ var > be < code > null</ code > .
905
909
< li > If < var > attribute namespace</ var > is not < code > null</ code > , then run these sub-steps:
906
910
< ol >
907
911
< li > If the value of < var > attribute namespace</ var > is the
908
912
< a title ="xmlns-ns "> XMLNS namespace</ a > and either the < var > attr</ var > 's
909
- < a title ="dom-attribute-prefix " data-spec ="DOM4 " class ="externalDFN "> prefix</ a >
913
+ < code > < a title ="dom-attribute-prefix " data-spec ="DOM4 " class ="externalDFN "> prefix</ a > </ code >
910
914
is < code > null</ code > and the < var > ignore namespace definition
911
915
attribute</ var > flag is < code > true</ code > or the < var > attr</ var > 's
912
- < a title ="dom-attribute-prefix " data-spec ="DOM4 " class ="externalDFN "> prefix</ a >
916
+ < code > < a title ="dom-attribute-prefix " data-spec ="DOM4 " class ="externalDFN "> prefix</ a > </ code >
913
917
is not < code > null</ code > and the < var > attr</ var > 's
914
- < a title ="concept-attribute-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a >
918
+ < code > < a title ="concept-attribute-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code >
915
919
matches the value of < var > duplicate prefix definition</ var > , then stop running
916
920
these steps and return to the loop to visit the next attribute.
917
921
< li > Otherwise, if there exists a key in < var > map</ var > that matches the value of < var > attribute
@@ -953,7 +957,7 @@ <h2>Serializing</h2>
953
957
< li > Append the following strings to < var > result</ var > :
954
958
< ol >
955
959
< li > The value of < var > attr</ var > 's
956
- < a title ="concept-attribute-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > ;
960
+ < code > < a title ="concept-attribute-localname " data-spec ="DOM4 " class ="externalDFN "> localName</ a > </ code > ;
957
961
< li > "< code > ="</ code > " (U+003D EQUALS SIGN, U+0022 QUOTATION MARK);
958
962
< li > The result of < a title ="concept-serialize-attr-value "> serializing an attribute value</ a >
959
963
given < var > attr</ var > 's
@@ -1043,7 +1047,7 @@ <h1>The <code>DOMParser</code> interface</h1>
1043
1047
and terminate these steps.
1044
1048
1045
1049
< li > Otherwise, throw a
1046
- < a data-spec ="DOM4 " title ="domexception " class ="externalDFN "> DOMException</ a > </ code >
1050
+ < code > < a data-spec ="DOM4 " title ="domexception " class ="externalDFN "> DOMException</ a > </ code >
1047
1051
with name < code > SyntaxError</ code > .
1048
1052
1049
1053
< p class =note > Some UAs do not throw an exception, but rather return a minimal
0 commit comments