[7] This is a work-in-progress documentation
for manakai's DOM extensions.


* Conventions

[30] 
@@ Keywords [Q@en[[['''MUST''']]]], [Q@en[[['''MUST NOT''']]]],
[Q@en[[['''REQUIRED''']]]],
[Q@en[[['''SHOULD''']]]], [Q@en[[['''SHOULD NOT''']]]],
[Q@en[[['''MAY''']]]], and [Q@en[[['''OPTIONAL''']]]]
are interpreted as described in [[RFC 2119]] [RFC 2119].

[32]
An [Q@en[[VAR@en[InterfaceName]] object]] refers to
an object that implements [VAR@en[InterfaceName]] interface.
Note that the object might also implement other
interfaces than [VAR@en[InterfaceName]].
However, unless explicitly specified, the term
[Q@en[[CODE(DOMi)@en[[[Text]]]] object]] does
not refer to a [CODE(DOMi)@en[[[CDATASection]]]] object
though the [CODE(DOMi)@en[[[CDATASection]]]] interface
extends the [CODE(DOMi)@en[[[Text]]]] interface.

[33]
When a [VAR@en[CONSTANT_NAME]] [VAR@en[ExceptionInterfaceName]]
is said to be thrown, an implementation [['''MUST''']]
throw an exception object that implements the
[VAR@en[ExceptionInterfaceName]] interface and
whose [CODE(DOMa)@en[[[code]]]] attribute is set
to the value of [VAR@en[CONSTANT_NAME]].

[34]
Algorithms shown in this document does not intend
to constraint the way to implement that feature.
Implementations are always free to implement that
feature in any way as long as that has the same
effect as the normative algorithm.

* New interfaces

- [[DOM XML Document Type Definition]] module
-- [CODE(DOMi)@en[[[DocumentXDoctype]]]]
-- [CODE(DOMi)@en[[[DocumentTypeDefinition]]]]
-- [CODE(DOMi)@en[[[ElementTypeDefinition]]]]
-- [CODE(DOMi)@en[[[AttributeDefinition]]]]
- [CODE(DOMi)@en[[[SerialWalker]]]]
- [[Atom DOM]]

* Extensions to existing interfaces

- [[manakai DOM [CODE(DOMi)@en[Node]] Extensions]]
- [[manakai DOM [CODE(DOMi)@en[Document]] Extensions]]

* Backward compatibility

[64] It [['''MUST''']] implement the definitions in the DOM Standard but commented out with
markers "AttrExodus" or "NodeExodus".  [SRC[[[DOM]]]]

;; [65] This is a [[willful violation]] to the [[DOM]] Standard that is intended to
obsolete them.  Since [[manakai]] is a Perl implementation of DOM, it has different
compatibility requirements from those in Web browsers.

[FIG[
[68] 
[PRE(IDL code)[
partial interface Node {
  attribute DOMString prefix;
};
]PRE]
]FIG]

[66] On setting, the [CODE(DOMa)@en[[[prefix]]]] attribute of the [CODE(DOMi)@en[[[Node]]]]
interface [['''MUST''']] run these steps:
[FIG[
= Let [VAR[prefix]] be the value being assigned.
= If the [[context object]]'s [[namespace]] is null or the empty string, throw an "[CODE[[[NamespaceError]]]]"
exception and terminate these steps.
= If [VAR[prefix]] is the empty string, let [VAR[prefix]] be null.
= If [VAR[prefix]] is not null, run these substeps:
== If [VAR[prefix]] does not match the [CODE[[[Name]]]] production in XML, throw an "[CODE[[[InvalidCharacterError]]]]" exception and terminate these steps.
== If [VAR[prefix]] does not match the [CODE[[[NCName]]]] production in Namespaces in XML, throw a "[CODE[[[NamespaceError]]]]" exception and terminate these steps.
= Let the [[prefix]] of the [[context object]] be [VAR[prefix]].
]FIG]

;; [67] This is the [[Chrome]] behavior. [TIME[2012-12-15T12:21:12.000Z]]

[78] For the [CODE(DOMm)@en[[[isEqualNode]]]] method of the [CODE(DOMi)@en[[[Node]]]] interface,
the following condition [['''MUST''']] be applied as well as the other conditions:
If the nodes are [CODE(DOMi)@en[[[Attr]]]] objects, their [[local name]], [[namespace]], and [[value]]
are equal respectively.

[DEL[
[80] If the [[context object]] is an [CODE(DOMi)@en[[[Attr]]]], the [CODE(DOMm)@en[[[textContent]]]]
attribute of the [CODE(DOMi)@en[[[Node]]]] interface [['''MUST''']] return the [[value]] of the attribute
on getting, or assign new value to the [[value]] of the attribute on setting.
]DEL]

[81] In the "[[clone]]" steps, when [VAR@en[node]] is an [CODE(DOMi)@en[[[Attr]]]] node,
or [VAR@en[node]] is an [CODE(DOMi)@en[[[Element]]]] node and its [[attribute list]] is copied,
[[namespace prefix]], [[namespace]], [[local name]], and [[value]] of attributes [['''MUST''']] be copied.

;; [82] Other values, including [[specified]], are not copied.

[89] The [CODE(DOMm)@en[[[isSupported]]]] method of the [CODE(DOMi)@en[[[Node]]]] interface
[['''MUST''']] return [[true]].

[90] If a non-[[null]] value is set to the [VAR@en[handler]] argument to the [CODE(DOMm)@en[[[setUserData]]]]
method of the [CODE(DOMi)@en[[[Node]]]] interface, a "[CODE(DOMe)@en[[[NotSupportedError]]]]" [['''MAY''']]
be thrown.

[150] When the [CODE(DOMa)@en[[[value]]]] attribute or the [CODE(DOMm)@en[[[manakaiAppendText]]]] method
of the [CODE(DOMi)@en[[[Attr]]]] object set the [[value]] of the [[attribute]], at the end of the
steps, [[attribute is set]] and [[attribute is changed]] if there is non-null [[owner element]]
for the [[context object]].

[151] When the [CODE(DOMi)@en[[[Attr]]]] node is [[adopt]]ed, if its [[owner element]] is not null,
just after the node's [[owner element]] is set to [[null]] but before the [[node document]] is set
to the new value, [[attribute is removed]].

[152] When an element's [CODE(HTMLa)@en[[[id]]]] attribute is set to the empty string,
unset the element's [[ID]].

[153] When an element's [CODE(HTMLa)@en[[[class]]]] attribute is set to the empty string,
set the element's [[classes]] to the empty list.

* Extension to the [CODE(DOMi)@en[Element]] interface

[54] Manakai's [CODE(DOMi)@en[[[Element]]]] objects
implement the [CODE(DOMa)@en[[[innerHTML]]]] attribute
of the [CODE(DOMi)@en[[[HTMLElement]]]] interface.

** Element type accessor

[FIG[
[83] 
[PRE(IDL code)[
[[partial]] [[interface]] [[Element]] {
  [[readonly]] [[attribute]] [[DOMString]] [[manakaiTagName]];
};
]PRE]
]FIG]

[84] The [DFN[[CODE(DOMa)@en[[[manakaiTagName]]]]]] [[attribute]] of the [CODE(DOMi)@en[[[Element]]]]
interface [['''MUST''']] return the same value as the [CODE(DOMa)@en[[[tagName]]]] attribute,
except that the return value are not converted to uppercase even when the [[context object]] is an
[[HTML element]].

[12]
The [DFN@en[[CODE(DOMm)@en[[[manakaiElementTypeMatch]]]] method]]
returns whether the [CODE(DOMi)@en[[[Element]]]]
belongs to the specified element type or not.

This method takes two parameters:
[CODE(DOMp)@en[[[namespaceURI]]]] and
[CODE(DOMp)@en[[[localName]]]].

The [CODE(DOMp)@en[[[namespaceURI]]]] parameter
is a [CODE(DOMi)@en[[[DOMString]]]].
It represents the namespace URI of the element type
to test.
Both [CODE(IDL)@en[[[null]]]] and an empty string
represents the null namespace as in the
[CODE(DOMp)@en[[[namespaceURI]]]] parameters
of other similar methods.

The [CODE(DOMp)@en[[[localName]]]] parameter
is a [CODE(DOMi)@en[[[DOMString]]]].
It represents the local name of the element type to test.

This method returns a [CODE(IDL)@en[[[boolean]]]] value.

This method [['''MUST''']] return [CODE(IDL)@en[[[null]]]]
if and only if:
- The [CODE(DOMi)@en[[[namespaceURI]]]] of the
[CODE(DOMi)@en[[[Element]]]] is [CODE(IDL)@en[[[null]]]],
the [CODE(DOMp)@en[[[namespaceURI]]]] parameter
is set to either [CODE(IDL)@en[[[null]]]] or an empty string,
and the [CODE(DOMp)@en[[[localName]]]] parameter
is set to the same value as the 
[CODE(DOMa)@en[[[manakaiLocalName]]]] attribute of the 
[CODE(DOMi)@en[[[Element]]]], or
- The [CODE(DOPMp)@en[[[namespaceURI]]]] parameter
is set to a non-empty [CODE(DOMi)@en[[[DOMString]]]]
and it is equal to the [CODE(DOMi)@en[[[namespaceURI]]]] of the
[CODE(DOMi)@en[[[Element]]]] and the 
[CODE(DOMp)@en[[[localName]]]] parameter
is set to the same value as the 
[CODE(DOMa)@en[[[manakaiLocalName]]]] attribute of the 
[CODE(DOMi)@en[[[Element]]]].

Otherwise, the method [['''MUST''']] return 
[CODE(IDL)@en[[[false]]]].


** Metadata accessor

[DEL[
[18]
The [DFN@en[[CODE(DOMa)@en[[[manakaiBaseURI]]]] attribute]]
of the [CODE(DOMi)@en[[[Element]]]] and
[CODE(DOMi)@en[[[ProcessingInstruction]]]] interfaces
corresponding to the [CODE(InfoProp)@en[[[base URI]]]]
property in the XML Information Set.  It contains
the base DOM URI of the [CODE(DOMi)@en[[[Element]]]]
or [CODE(DOMi)@en[[[ProcessingInstruction]]]] object,
if it is explicitly set to the object.

;; To obtain the computed base URI of the 
[CODE(DOMi)@en[[[Element]]]] or
[CODE(DOMi)@en[[[ProcessingInstruction]]]] object, use the
[CODE(DOMa)@en[[[baseURI]]]] attribute
of the [CODE(DOMi)@en[[[Node]]]] interface instead.

The type of this attribute is [CODE(DOMi)@en[[[DOMString]]]].
This attribute is read-write.

On getting, the base DOM URI [['''MUST''']] be
returned if it is specified to the 
[CODE(DOMi)@en[[[Element]]]] or
[CODE(DOMi)@en[[[ProcessingInstruction]]]] object.  Otherwise,
[CODE(IDL)@en[[[null]]]] [['''MUST''']] be returned.

On setting, if the [CODE(DOMi)@en[[[Element]]]]
or [CODE(DOMi)@en[[[ProcessingInstruction]]]] object
is read-only, then a
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]] 
[CODE(DOMi)@en[[[DOMException]]]]
[['''MUST''']] be thrown.  Otherwise,
if the new value is [CODE(IDL)@en[[[null]]]],
then the explicit specification of the base URI
of the [CODE(DOMi)@en[[[Element]]]] or
[CODE(DOMi)@en[[[ProcessingInstruction]]]] object is unset.
Otherwise, the new value is set to
the [CODE(DOMi)@en[[[Element]]]]
or [CODE(DOMi)@en[[[ProcessingInstruction]]]] object
as the base URI.
Note that no lexical checking is performed
on the new value.

;; The [CODE(DOMa)@en[[[manakaiBaseURI]]]],
which is analogue to the [CODE(InfoProp)@en[[[base URI]]]]
property, is independent from the
[CODE(XMLa)@en[[[xml]]:[[base]]]] attribute.
Setting the [CODE(DOMa)@en[[[manakaiBaseURI]]]]
does not affect to the [CODE(XMLa)@en[[[xml]]:[[base]]]]
or any other base URI sources and vice versa.
]DEL]

** Identifiers

[FIG[
[104] 
[PRE(IDL code)[
[[partial]] [[interface]] [[Element]] {
  [[readonly]] [[attribute]] [[DOMString]][] [[manakaiIds]];
};
]PRE]
]FIG]

[55] The [DFN@en[[CODE(DOMa)@en[manakaiIds]] attribute]]
of an element [VAR@en[element]], on getting, [['''MUST''']] follow the steps below:
[FIG[
= Let [VAR@en[list]] a new empty [DEL[[CODE(DOMi)@en[[[DOMStringList]]]]]] [CODE(DOMi)@en[[[DOMString]]'''['''''']''']] object.
= For each [CODE(DOMi)@en[[[Attr]]]] [VAR@en[attribute]] in the
[CODE(DOMa)@en[[[attributes]]]] list of the [VAR@en[element]]:
== Skip the following substeps if the [CODE(DOMa)@en[[[isId]]]] of the
[VAR@en[attribute]] is false.
== Let [VAR@en[value]] the [CODE(DOMa)@en[[[value]]]] of the [VAR@en[attribute]].
== Append [VAR@en[value]] to [VAR@en[list]] if there is no string 
that is equal to [VAR@en[value]] in [VAR@en[list]] yet.
= Return [VAR@en[list]].
]FIG]

;; The [DEL[[CODE(DOMi)@en[[[DOMStringList]]]]]] [CODE(DOMi)@en[[[DOMString]]'''['''''']''']] object returned by this attribute
is ''not'' [[live]].

;; Values contained in the [DEL[[CODE(DOMi)@en[[[DOMStringList]]]]]] [CODE(DOMi)@en[[[DOMString]]'''['''''']''']] object
returned by this attribute might not be a valid ID; for example, 
it might be the empty string, or there are another element with
same ID in the earlier part of the document in tree order.

;; The order in which strings are listed in the [DEL[[CODE(DOMi)@en[[[DOMStringList]]]]]] [CODE(DOMi)@en[[[DOMString]]'''['''''']''']]
object depends on the order of the [CODE(DOMi)@en[[[Attr]]]] nodes
in the [CODE(DOMa)@en[[[attributes]]]] attribute.  In other word,
the order is implementation dependent but is stable in a specific
implementation.

[DEL[
The type of this attribute is [CODE(DOMi)@en[[[DOMStringList]]]].
This attribute is read-only.
]DEL]

** Microdata

[FIG[
[179] 
[PRE(IDL code)[
partial interface [[HTMLElement]] {
  [[HTMLPropertiesCollection]] [[manakaiGetProperties]]();
};
]PRE]
]FIG]

[180] The [CODE(DOMm)@en[[[manakaiGetProperties]]]] method [['''MUST''']] return a [[static]]
[CODE(DOMi)@en[[[HTMLPropertiesCollection]]]] that contains the nodes that would be contained
in the [CODE(DOMa)@en[[[properties]]]] [CODE(DOMi)@en[[[HTMLPropertiesCollection]]]] of the
[[context object]].  The [CODE(DOMi)@en[[[PropertyNodeList]]]] objects returned by the
[CODE(DOMi)@en[[[HTMLPropertiesCollection]]]] [['''MUST''']] also be [[static]].

;; [181] See also [[manakai's DOM Perl binding]], which defines how [CODE(DOMi)@en[[[HTMLPropertiesCollection]]]]
is implemented in Perl.

* Extension to the [CODE(DOMi)@en[NodeList]] and the [CODE(DOMi)@en[NamedNodeMap]] interfaces

''This attribute is obsolete.''

[8]
The [DFN@en[[CODE(DOMa)@en[[[manakaiReadOnly]]]] attribute]]
contains whether the [CODE(DOMi)@en[[[NodeList]]]]
or [CODE(DOMi)@en[[[NamedNodeMap]]]] is read-only or not.

The type of this attribute is [CODE(IDL)@en[[[boolean]]]].
This attribute is read-only.

@@ ISSUE: Is setter necessary?

= If the [CODE(DOMi)@en[[[NodeList]]]] or
[CODE(DOMi)@en[[[NamedNodeMap]]]] is the read-only
attribute value of a [CODE(DOMi)@en[[[Node]]]], then the getter
[['''MUST''']] return the [CODE(DOMa)@en[[[manakaiReadOnly]]]]
attribute value of the [CODE(DOMi)@en[[[Node]]]].
= Otherwise, if the [CODE(DOMi)@en[[[NodeList]]]] is the
[CODE(DOMa)@en[[[childNodes]]]] attribute value of 
a [CODE(DOMi)@en[[[Node]]]] whose [CODE(DOMa)@en[[[nodeType]]]]
does never have any child by definition,
then the getter [['''MUST''']] return [CODE(IDL)@en[[[true]]]].
= Otherwise, the getter [['''MUST''']]
return [CODE(IDL)@en[[[true]]]] unless otherwise specified.

;; For example, the [CODE(DOMa)@en[[[manakaiReadOnly]]]]
attribute of the [CODE(DOMa)@en[[[childNodes]]]]
[CODE(DOMi)@en[[[NodeList]]]] of an [CODE(DOMi)@en[[[Element]]]]
has same value as the [CODE(DOMa)@en[[[manakaiReadOnly]]]]
of the [CODE(DOMi)@en[[[Element]]]], while
the [CODE(DOMa)@en[[[manakaiReadOnly]]]]
attribute of a [CODE(DOMi)@en[[[NodeList]]]] obtained by
the [CODE(DOMm)@en[[[getElementsByTagNameNS]]]]
method of that [CODE(DOMi)@en[[[Element]]]]
or the [CODE(DOMa)@en[[[manakaiReadOnly]]]] attribute
of a [CODE(DOMi)@en[[[NodeList]]]] of a
[CODE(DOMi)@en[[[ProcessingInstruction]]]]
always exhibit [CODE(IDL)@en[[[true]]]].


* Extension to the [CODE(DOMi)@en[Attr]] interface

[FIG[
[85] 
[PRE(IDL code)[
[[partial]] [[interface]] [[Attr]] {
  [[readonly]] [[attribute]] [[DOMString]] [[manakaiName]];
};
]PRE]
]FIG]

[86] The [DFN[[CODE(DOMa)@en[[[manakaiName]]]]]] [[attribute]] of the [CODE(DOMi)@en[[[Attr]]]]
[[interface]] [['''MUST''']] return the [[name]] of the [[context object]].

;; [87] Use of this attribute is discouraged in favor of the [CODE(DOMa)@en[[[name]]]] attribute.

** Setter extension

[DEL[
[19]
The [DFN@en[[CODE(DOMa)@en[[[specified]]]] attribute]]
is now read-write.
[FIG[
[PRE(IDL code)[
[[partial]] [[interface]] [[Attr]] {
  [[attribute]] [[boolean]] [[specified]];
}
]PRE]
]FIG]

[DEL[
On setting, if the [CODE(DOMi)@en[[[Attr]]]] is read-only,
then an [CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
exception [['''MUST''']] be thrown.  Otherwise,
the new value [['''MUST''']] set as the 
[CODE(DOMa)@en[[[specified]]]] flag of the 
[CODE(DOMi)@en[[[Attr]]]], except when
the [CODE(DOMa)@en[[[ownerElement]]]] of the
[CODE(DOMi)@en[[[Attr]]]] is [CODE(IDL)@en[[[null]]]],
in which case the [CODE(DOMa)@en[[[specified]]]] flag
[['''MUST''']] be set to [CODE(IDL)@en[[[true]]]] (if
not yet) nevertheless the new value.
]DEL]

[77] On setting, the [DFN[[CODE(DOMa)@en[[[specified]]]] attribute]] of the [CODE(DOMi)@en[[[Attr]]]]
interface [['''MUST''']] set the [[specified]] flag of the [[context object]] to the newly-specified value.

;; [76] Note that setting [CODE(DOMa)@en[[[specified]]]] flag
to [CODE(IDL)@en[[[false]]]] might make the
serialized representation of the [CODE(DOMi)@en[[[Document]]]]
inconsistent with the [CODE(DOMi)@en[[[Document]]]] itself.
]DEL]

[102] The [DFN[[CODE(DOMa)@en[[[specified]]]]]] attribute [['''MUST''']] return true.

[DEL[
[20] The [DFN@en[[CODE(DOMa)@en[[[isId]]]] attribute]]
is now read-write.

On setting, if the [CODE(DOMi)@en[[[Attr]]]] is read-only,
then an [CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
exception [['''MUST''']] be thrown.  Otherwise,
the flag that represents whether the [CODE(DOMi)@en[[[Attr]]]]
is a user-determined ID attribute or not [['''MUST''']]
be set to the new value.

;; Setting [CODE(IDL)@en[[[false]]]] to this attribute
does not make the [CODE(DOMi)@en[[[Attr]]]] 
non-[CODE(XML)@en[[[ID]]]] if the [CODE(DOMi)@en[[[Attr]]]]
is marked as an [CODE(XML)@en[[[ID]]]] by other
mean than the user-determined [CODE(XML)@en[[[ID]]]] flag,
e.g. by DTD attribute definition.
]DEL]

[103] The [DFN[[CODE(DOMa)@en[[[isId]]]]]] attribute [['''MUST''']] return true if the
[[namespace]] of the [[context object]] is [[null]] and the [[local name]] of the
[[context object]] is [CODE[[[id]]]], or false otherwise.

** Attribute type accessor

[21]
The [DFN@en[[CODE(DOMa)@en[[[manakaiAttributeType]]]] attribute]]
contains the declared type of the [CODE(DOMi)@en[[[Attr]]]].

The type of this attribute is [CODE(IDL)@en[[[unsigned short]]]].
This attribute is read-write.

;; This attribute corresponding to the
[CODE(InfoProp)@en[[[attribute type]]]] property
of an attribute information item in the XML Information Set.

The getter [['''MUST''']] return the declared
type of the [CODE(DOMi)@en[[[Attr]]]].
It is expected that a constant in the 
[CODE(DOM)@en[[[DeclaredValueType]]]] constant group
is returned.  If no declared type is explicitly set,
then [CODE(DOMc)@en[[[NO_TYPE_ATTR]]]]
[['''MUST''']] be returned.

On setting, if the [CODE(DOMi)@en[[[Attr]]]] is read-only,
then an [CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
exception [['''MUST''']] be thrown.  Otherwise,
the new value [['''MUST''']] be set as
the attribute value.  It is expected that a constant in the 
[CODE(DOM)@en[[[DeclaredValueType]]]] constant group
is set to the attribute, though it is not checked
by the attribute.


* Extensions to the [CODE(DOMi)@en[DocumentType]] interface


** Children

[48]
[CODE(DOMi)@en[[[DocumentType]]]] nodes [['''MAY''']]
contain zero or more [CODE(DOMi)@en[[[ProcessingInstruction]]]]
nodes in its child node list.

If a [CODE(DOMi)@en[[[DocumentType]]]] node is
created from the document type declaration information
item in an XML information set, the 
[CODE(InfoProp)@en[[[children]]]] list [['''MUST''']]
be reflected to the [CODE(DOMa)@en[[[childNodes]]]]
list of the [CODE(DOMi)@en[[[DocumentType]]]] node;
the list [['''MUST''']] contain zero or more
[CODE(DOMi)@en[[[ProcessingInstruction]]]] nodes
created from the processing instruction information
items in the [CODE(InfoProp)@en[[[children]]]]
list in the same order.

If a [CODE(DOMi)@en[[[DocumentType]]]] node is mapped
to a document type declaration information item, 
the [CODE(InfoProp)@en[[[children]]]] list [['''MUST''']]
reflect the [CODE(DOMa)@en[[[childNodes]]]] list of
the [CODE(DOMi)@en[[[DocumentType]]]] node;
the list [['''MUST''']] contain zero or more
processing instruction information items mapped
from the [CODE(DOMi)@en[[[ProcessingInstruction]]]] nodes
in the [CODE(DOMa)@en[[[childNodes]]]] list in the
same order.

If a parser create a [CODE(DOMi)@en[[[DocumentType]]]]
node and mark it as read-only, then all child
nodes [['''MUST''']] also be marked as read-only.


** 

[FIG[
[141] 
[PRE(IDL code)[
[[partial]] [[interface]] [[DocumentType]] {
  [TreatNullAs=EmptyString] [[attribute]] [[DOMString]] [[publicId]];
  [TreatNullAs=EmptyString] [[attribute]] [[DOMString]] [[systemId]];
};
[[partial]] [[interface]] [[Entity]] {
  [TreatNullAs=EmptyString] [[attribute]] [[DOMString]] [[publicId]];
  [TreatNullAs=EmptyString] [[attribute]] [[DOMString]] [[systemId]];
};
[[partial]] [[interface]] [[Notation]] {
  [TreatNullAs=EmptyString] [[attribute]] [[DOMString]] [[publicId]];
  [TreatNullAs=EmptyString] [[attribute]] [[DOMString]] [[systemId]];
};
]PRE]
]FIG]

[37] The [DFN@en[[CODE(DOMa)@en[[[publicId]]]] attribute]]
and the [DFN@en[[CODE(DOMa)@en[[[systemId]]]] attribute]]
of [CODE(DOMi)@en[[[DocumentType]]]],
[CODE(DOMi)@en[[[Entity]]]], and
[CODE(DOMi)@en[[[Notation]]]] objects are now read-write.

The setter [['''MUST''']] throw a
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the 
[CODE(DOMi)@en[[[Node]]]] object is read-only.
Otherwise, it [['''MUST''']] set the specified value
to the attribute.  No normalization, lexical validation,
or relative reference resolving is performed.  
[CODE(IDL)@en[[[null]]]], which represents no public or 
system identifier is provided, might be specified.

Setting public or system identifier does never result
in any lexical or logical structure of the
document being changed.  In particular, no external
entity referenced by new identifier will be loaded.

;; Setting an invalid or non-normalized identifier
might make the object non-serializable.  Setting
a non-[CODE(IDL)@en[[[null]]]] public identifier to a [CODE(DOMi)@en[[[DocumentType]]]] or 
[CODE(DOMi)@en[[[Entity]]]] object that does not have
non-[CODE(IDL)@en[[[null]]]] system identifier or
setting [CODE(IDL)@en[[[null]]]] as the system identifier
of a [CODE(DOMi)@en[[[DocumentType]]]] or
[CODE(DOMi)@en[[[Entity]]]] object that does have
non-[CODE(IDL)@en[[[null]]]] public identifier will
make that object non-serializable.

@@ ISSUE: In HTML5, Firefox 1.5, and Opera 9, not specifying
public or system identifier results in empty strings.

[DEL[
[41]
The [DFN@en[[CODE(DOMa)@en[[[declarationBaseURI]]]] attribute]]
and the
[DFN@en[[CODE(DOMa)@en[[[manakaiDeclarationBaseURI]]]] attribute]]
of a [CODE(DOMi)@en[[[DocumentType]]]] object represent
the base DOM URI of the [CODE(DOMi)@en[[[DocumentType]]]]
object.

Use of [CODE(DOMa)@en[[[declarationBaseURI]]]] attribute
is ''deprecated''.

;; It is the base URI of the document type declaration
if the [CODE(DOMi)@en[[[DocumentType]]]] object comes
from an XML document entity and can be used to 
resolve relative DOM URI specified to the
[CODE(DOMa)@en[[[systemId]]]] attribute of 
the [CODE(DOMi)@en[[[DocumentType]]]] object.

This attribute is read-write.
The type of this attribute is [CODE(DOMi)@en[[[DOMString]]]].

The getter [['''MUST''']] return the value
of the [CODE(DOMa)@en[[[baseURI]]]] attribute of 
the [CODE(DOMa)@en[[[ownerDocument]]]] of the
[CODE(DOMi)@en[[[DocumentType]]]] object if the
[CODE(DOMa)@en[[[ownerDocument]]]] attribute
is not [CODE(IDL)@en[[[null]]]].  If it is 
[CODE(IDL)@en[[[null]]]], the getter [['''MUST''']]
return [CODE(IDL)@en[[[null]]]].

The setter [['''MUST''']] do nothing,
including when the [CODE(DOMi)@en[[[DocumentType]]]]
object is read-only.
]DEL]

** Implementation Information

''This attribute is obsolete.''

[49]
The [DFN@en[[CODE(DOMa)@en[[[implementation]]]] attribute]]
represents the DOM implementation which the 
[CODE(DOMi)@en[[[DocumentType]]]] node belongs to.

This attribute is read-only.
The type of this attribute is 
[CODE(DOMi)@en[[[DOMImplementation]]]].

The getter of this attribute [['''MUST''']]
return the [CODE(DOMi)@en[[[DOMImplementation]]]]
object which the [CODE(DOMi)@en[[[DocumentType]]]]
node belongs to.


* Extensions to the [CODE(DOMi)@en[[[Entity]]]] interface


** Entity Identifiers

[DEL[
[FIG[
[117] 
[PRE(IDL code)[
[[partial]] [[interface]] [[Entity]] {
  [[attribute]] [[DOMString]] [[publicId]];
  [[attribute]] [[DOMString]] [[systemId]];
  [[attribute]] [[DOMString]]? [[declarationBaseURI]];
  [[attribute]] [[DOMString]]? [[manakaiDeclarationBaseURI]];
  [[attribute]] [[DOMString]]? [[manakaiEntityBaseURI]];
  [[attribute]] [[DOMString]]? [[manakaiEntityURI]];
};

[[partial]] [[interface]] [[Notation]] {
  [[attribute]] [[DOMString]]? [[manakaiDeclarationBaseURI]];
};
]PRE]
]FIG]

[38]
The [DFN@en[[CODE(DOMa)@en[[[publicId]]]] attribute]] and
the [DFN@en[[CODE(DOMa)@en[[[systemId]]]] attribute]]
of the [CODE(DOMi)@en[[[Entity]]]] interface is so
extended that they are read-write.
See >>37 for the complete definition.

[40]
The [DFN@en[[CODE(DOMa)@en[[[manakaiDeclarationBaseURI]]]] attribute]]
of an [CODE(DOMi)@en[[[Entity]]]] or
[CODE(DOMi)@en[[[Notation]]]] object and the [DFN[[CODE(DOMa)@en[[[declarationBaseURI]]]]]] attribute
of the [CODE(DOMi)@en[[[Entity]]]] object represents
the base DOM URI of the entity or notation declaration by which 
the entity or notation represented by the 
[CODE(DOMi)@en[[[Node]]]] object is declared.

The getter [['''MUST''']] return the declaration base
DOM URI.  If there is no explicit declaration base URI
information attached to the [CODE(DOMi)@en[[[Node]]]] object,
then the base URI of the [CODE(DOMi)@en[[[Node]]]] object,
i.e. the [CODE(DOMa)@en[[[baseURI]]]] attribute value
of the [CODE(DOMi)@en[[[Node]]]] object, [['''MUST''']]
be returned.

;; Note that if there is no explicit base URI information
attached to the [CODE(DOMi)@en[[[Node]]]] object and
the [CODE(DOMa)@en[[[baseURI]]]] attribute of that
object is [CODE(IDL)@en[[[null]]]], then the value
of this attribute is also [CODE(IDL)@en[[[null]]]].

The setter [['''MUST''']] throw a 
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the 
[CODE(DOMi)@en[[[Node]]]] object is read-only.
Otherwise, it [['''MUST''']] set the specified value
as the declaration base DOM URI of the [CODE(DOMi)@en[[[Node]]]]
object.  The specified value must be an absolute DOM URI.
However, no lexical validation or relative reference resolution
is performed on setting.  In addition, it does not affect
on the value of [CODE(DOMa)@en[[[systemId]]]] attribute,
the replacement subtree of the [CODE(DOMi)@en[[[Entity]]]]
object, nor any of entity reference or notation
attribute in the document.

If [CODE(IDL)@en[[[null]]]] is specified, the
declaration base DOM URI of the [CODE(DOMi)@en[[[Node]]]]
is unset.  It does not affect to the [CODE(DOMa)@en[[[baseURI]]]]
attribute.

If an [CODE(DOMi)@en[[[Entity]]]] or [CODE(DOMi)@en[[[Notation]]]]
object is created from an XML Information Set information
item, the [CODE(InfoProp)@en[[[declaration base URI]]]]
property value, if specified, or [CODE(IDL)@en[[[null]]]]
otherwise, [['''MUST''']] be set to this attribute.

If an [CODE(DOMi)@en[[[Entity]]]] or 
[CODE(DOMi)@en[[[Notation]]]] object is mapped to
an unexpanded entity information item or
a notation information item, the
[CODE(DOMa)@en[[[manakaiDeclarationBaseURI]]]]
attribute value, if it is non-[CODE(IDL)@en[[[null]]]],
or [[no value]] otherwise, [['''MUST''']] be 
set to the [CODE(InfoProp)@en[[[declaration base URI]]]]
property of the information item.

[44]
The [DFN@en[[CODE(DOMa)@en[[[manakaiEntityBaseURI]]]] attribute]]
of an [CODE(DOMi)@en[[[Entity]]]] object represents
the base DOM URI of the entity represented by
the [CODE(DOMi)@en[[[Entity]]]] object.

This attribute is read-write.
The type of this attribute is [CODE(DOMi)@en[[[DOMString]]]].

The getter [['''MUST''']] return the base DOM URI
of the entity by the following algorithm:
= If the base DOM URI of the referenced entity
is explicitly specified to the object, then return it.
= Otherwise, if the [CODE(DOMa)@en[[[manakaiEntityURI]]]] 
attribute of the object has non-[CODE(IDL)@en[[[null]]]] value,
then return it.
= Otherwise, return the [CODE(DOMa)@en[[[baseURI]]]]
attribute value of the [CODE(DOMi)@en[[[EntityReference]]]]
object.

;; Therefore, the entity base URI for internal general
entities are same as the base URI for document 
unless explicitly overridden by the application.

;; Note that the algorithm might return [CODE(IDL)@en[[[null]]]].

The setter [['''MUST''']] throw a
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the object
is read-only.  Otherwise, if the specified value
is [CODE(IDL)@en[[[null]]]], it [['''MUST''']] unset
the explicit entity base URI specification for the object.
Otherwise, it [['''MUST''']] set the specified value
as the entity base URI of the object.

The specified value must be an absolute DOM URI.
However, no lexical validation or relative reference
resolution is performed on the setting.  Likewise,
setting the value does not affect on the entity base
URI of any [CODE(DOMi)@en[[[EntityReference]]]] 
object whose [CODE(DOMa)@en[[[nodeName]]]],
[CODE(DOMa)@en[[[publicId]]]], or 
[CODE(DOMa)@en[[[systemId]]]] is same as the
[CODE(DOMi)@en[[[Entity]]]] object's.
The exception is the nodes in the subtree rooted by the
[CODE(DOMi)@en[[[Entity]]]] object, where the new
base URI might affect the base URIs of those objects.

[45] The [DFN@en[[CODE(DOMa)@en[[[manakaiEntityURI]]]] attribute]]
of an [CODE(DOMi)@en[[[Entity]]]] object represents the DOM URI
of the entity represented by the object.

;; It might or might not be equal to the DOM URI
contained in the [CODE(DOMa)@en[[[systemId]]]] attribute
of the object or the absolute URI obtained by
resolving [CODE(DOMa)@en[[[systemId]]]] attribute
against [CODE(DOMa)@en[[[manakaiDeclarationBaseURI]]]]
attribute of the object.  In particular, in case
a catalog mechanism is used or a redirection is 
encountered during the entity resolution phase of the
parsing, the entity URI is typically different from
the one specified as the system identifier.

@@ ISSUE: Security concern - in scripted implementation,
it might be inappropriate to leak a URI of catalog-resolved
entity.

The getter [['''MUST''']] return the DOM URI of the entity
obtained by the following algorithm:
= If the DOM URI of the entity represented by the object
is explicitly set by application or during the tree
construction, then return it.
= Otherwise, if the [CODE(DOMa)@en[[[systemId]]]] attribute
of the object contains a non-[CODE(IDL)@en[[[null]]]] value,
then return the value, resolved against the 
[CODE(DOMa)@en[[[manakaiDeclarationBaseURI]]]] attribute
value if the value is not an absolute DOM URI and 
that attribute value is not [CODE(IDL)@en[[[null]]]].  
= Return [CODE(IDL)@en[[[null]]]].

The setter [['''MUST''']] throw a
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the object
is read-only.  Otherwise, if the specified value
is [CODE(IDL)@en[[[null]]]], it [['''MUST''']] unset
the explicit entity URI specification for the object.
Otherwise, it [['''MUST''']] set the specified value
as the entity URI of the object.

The specified value must be an absolute DOM URI.
However, no lexical validation or relative reference
resolution is performed on the setting.  Likewise,
setting the value does not affect on the entity base
URI of any [CODE(DOMi)@en[[[EntityReference]]]] 
object whose [CODE(DOMa)@en[[[nodeName]]]],
[CODE(DOMa)@en[[[publicId]]]], or 
[CODE(DOMa)@en[[[systemId]]]] is same as the
[CODE(DOMi)@en[[[Entity]]]] object's.
The exception is the nodes in the subtree rooted by the
[CODE(DOMi)@en[[[Entity]]]] object, where the new
base URI might affect the base URIs of those objects.

@@ TODO: We need to define the exact way to
get absolute DOM URI from a relative DOM URI.
(And "http://www.example.com/a/../b/" is normalized or not.)

@@ ISSUE: Should we provide an attribute that 
contains the absolute URI representation of
the system id?
]DEL]

** Character Encoding

[52] The [DFN@en[[CODE(DOMa)@en[[[inputEncoding]]]] attribute]]
of the [CODE(DOMi)@en[[[Entity]]]] interface is now
read-write.  See >>17 for the definition.


** Entity Content

[FIG[
[118] 
[PRE(IDL code)[
[[partial]] [[interface]] [[Entity]] {
  [[attribute]] [[boolean]] [[hasReplacementTree]];
  [[attribute]] [[boolean]] [[isExternallyDeclared]];
  [[attribute]] [[DOMString]]? [[notationName]];
  [[attribute]] [[DOMString]]? [[xmlEncoding]];
  [[attribute]] [[DOMString]]? [[xmlVersion]];
};
]PRE]
]FIG]

[27]
The [DFN@en[[CODE(DOMa)@en[[[hasReplacementTree]]]] attribute]]
of an [CODE(DOMi)@en[[[Entity]]]] object contains
whether the structure of the replacement text is
available via the child list of the 
[CODE(DOMi)@en[[[Entity]]]] or not.

The getter [['''MUST''']] return the value of the flag
associated to this attribute.

The setter [['''MUST''']] throw a 
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the 
[CODE(DOMi)@en[[[Entity]]]] object is read-only.
Otherwise, it [['''MUST''']] set the specified value
to the flag associated to this attribute.

If a parser create a [CODE(DOMi)@en[[[Entity]]]] object
that represents a general entity, it set the value 
of this attribute.  If it set this attribute as
[CODE(IDL)@en[[[false]]]], then it [['''MUST''']]
make the child list of the [CODE(DOMi)@en[[[Entity]]]]
object empty.

;; An application might set this attribute as 
[CODE(IDL)@en[[[false]]]] even if the
[CODE(DOMi)@en[[[Entity]]]] object has child nodes.
If the value of this attribute is [CODE(IDL)@en[[[false]]]],
any child of the [CODE(DOMi)@en[[[Entity]]]] object
should be ignored for the purpose of e.g. serialization.

When an [CODE(DOMi)@en[[[EntityReference]]]] object
is created and then the subtree of the 
[CODE(DOMi)@en[[[Entity]]]] object is cloned to
that object, any child node [['''MUST''']] be 
ignored if the attribute is set to [CODE(IDL)@en[[[false]]]].

;; Newly created [CODE(DOMi)@en[[[Entity]]]] object
by [CODE(DOMm)@en[[[createGeneralEntity]]]] has
[CODE(DOMa)@en[[[hasReplacementTree]]]] attribute
set to [CODE(IDL)@en[[[false]]]].

[46]
The [DFN@en[[CODE(DOMa)@en[[[notationName]]]] attribute]]
is now read-write.

The setter [['''MUST''']] throw a
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]] 
[CODE(DOMi)@en[[[DOMException]]]] if the object is 
read-only.  Otherwise, it [['''MUST''']] set the
specified value as the notation name of the object.
Note that the new value might be [CODE(IDL)@en[[[null]]]].

The setter perform no lexical validation of the new
value.  The new notation name might not
be an XML Name and therefore the object might become
non-serializable.  In a well-formed XML document,
unparsed entities have notation names and parsed entities
do not.  However, setting new value to the attribute
might break this rule and the result document might
be inconsistent.

[47]
The [DFN@en[[CODE(DOMa)@en[[[xmlEncoding]]]] attribute]] and the [DFN[[CODE(DOMa)@en[[[xmlVersion]]]]]]
attribute
of the [CODE(DOMi)@en[[[Entity]]]] interface is
now read-write.  See >>26 for the definition.

[119] The [DFN[[CODE(DOMa)@en[[[isExternallyDeclared]]]]]] attribute of the [CODE(DOMi)@en[[[Entity]]]]
object, on getting, [['''MUST''']] return whether the [[externally declared]] flag
of the [[context object]] is set or not.  On setting, it [['''MUST''']] set the [[externally declared]]
flag of the object if the new value is true, or unset the flag otherwise.

[120] When an [CODE(DOMi)@en[[[Entity]]]] object is created in the process of parsing the XML document,
if the entity is externally declared [SRC[XML]], the [[externally declared]] flag of the object
[['''MUST''']] set.  Otherwise the flag [['''MUST''']] be unset initially.

** Parent

[50]
The 
[DFN@en[[CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]] attribute]]
of an [CODE(DOMi)@en[[[Entity]]]], [CODE(DOMi)@en[[[Notation]]]],
or [CODE(DOMi)@en[[[ElementTypeDefinition]]]] node
is read-only and its type is 
[CODE(DOMi)@en[[[DocumentTypeDefinition]]]].
Its value is the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node
to which the [CODE(DOMi)@en[[[Node]]]] is attached.

The attribute [['''MUST''']] return the 
[CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node
in whose [CODE(DOMa)@en[[[generalEntities]]]],
[CODE(DOMa)@en[[[notations]]]], or
[CODE(DOMa)@en[[[elementTypes]]]] list
the [CODE(DOMi)@en[[[Node]]]] is contained.
There should be at most one such 
[CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node.
If there is no such node, then the attribute
[['''MUST''']] return [CODE(IDL)@en[[[null]]]].


* Extensions to the [CODE(DOMi)@en[EntityReference]] interface

[36] The [DFN@en[[CODE(DOMa)@en[[[manakaiExpanded]]]] attribute]]
of an [CODE(DOMi)@en[[[EntityReference]]]] object 
represents whether the entity reference is expanded so 
that its children list represents a part of the document.

This attribute is read-write.
The type of the this attribute is [CODE(IDL)@en[[[boolean]]]].

The getter [['''MUST''']] return the value of the flag
associated to this attribute.

The setter [['''MUST''']] throw a 
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the 
[CODE(DOMi)@en[[[Entity]]]] object is read-only.
Otherwise, it [['''MUST''']] set the specified value
to the flag associated to this attribute.

If a parser create a [CODE(DOMi)@en[[[EntityReference]]]] object
that represents a general entity reference, it set the value 
of this attribute.  If it set this attribute as
[CODE(IDL)@en[[[false]]]], then it [['''MUST''']]
make the child list of the [CODE(DOMi)@en[[[EntityReference]]]]
object empty.

;; An application might set this attribute as 
[CODE(IDL)@en[[[false]]]] even if the
[CODE(DOMi)@en[[[EntityReference]]]] object has child nodes.
If the value of this attribute is [CODE(IDL)@en[[[false]]]],
any child of the [CODE(DOMi)@en[[[EntityReference]]]] object
should be ignored for the purpose of e.g. serialization.

When an [CODE(DOMi)@en[[[EntityReference]]]] object
is created and then the subtree of the 
[CODE(DOMi)@en[[[Entity]]]] object is cloned to
that object, the [CODE(DOMa)@en[[[manakaiExpanded]]]]
[['''MUST''']] be set to the same value as
[CODE(DOMa)@en[[[hasReplacementTree]]]] attribute
of that object.

;; Newly created [CODE(DOMi)@en[[[EntityReference]]]] object
by [CODE(DOMm)@en[[[createEntityReference]]]] has
[CODE(DOMa)@en[[[manakaiExpanded]]]] attribute
set to [CODE(IDL)@en[[[false]]]] unless
the replacement tree is cloned to the 
[CODE(DOMi)@en[[[EntityReference]]]] object.

[42]
The [DFN@en[[CODE(DOMa)@en[[[manakaiEntityBaseURI]]]] attribute]]
of an [CODE(DOMi)@en[[[EntityReference]]]] object represents
the base DOM URI of the entity referenced by 
the [CODE(DOMi)@en[[[EntityReference]]]] object.

This attribute is read-write.
The type of this attribute is [CODE(DOMi)@en[[[DOMString]]]].

The getter [['''MUST''']] return the base DOM URI
of the entity by the following algorithm:
= If the base DOM URI of the referenced entity
is explicitly specified to the 
[CODE(DOMi)@en[[[EntityReference]]]] object, then
return it.
= Otherwise, return the [CODE(DOMa)@en[[[baseURI]]]]
attribute value of the [CODE(DOMi)@en[[[EntityReference]]]]
object.

;; Therefore, the entity base URI for internal general
entities are same as the base URI for the external
or document entity in which the entity is referenced,
unless explicitly overridden later by application.

;; Note that the algorithm might return [CODE(IDL)@en[[[null]]]].

The setter [['''MUST''']] throw a
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the
[CODE(DOMi)@en[[[EntityReference]]]] object
is read-only.  Otherwise, if the specified value
is [CODE(IDL)@en[[[null]]]], it [['''MUST''']] unset
the explicit entity base URI specification for the 
[CODE(DOMi)@en[[[EntityReference]]]] object.
Otherwise, it [['''MUST''']] set the specified value
as the entity base URI of the [CODE(DOMi)@en[[[EntityReference]]]]
object.

The specified value must be an absolute DOM URI.
However, no lexical validation or relative reference
resolution is performed on the setting.  Likewise,
setting the value does not affect on the entity base
URI of any [CODE(DOMi)@en[[[Entity]]]] object 
and any other [CODE(DOMi)@en[[[EntityReference]]]] 
object whose [CODE(DOMa)@en[[[nodeName]]]],
[CODE(DOMa)@en[[[publicId]]]], or 
[CODE(DOMa)@en[[[systemId]]]] is same as 
[CODE(DOMi)@en[[[EntityReference]]]] object's.

;; Setting [CODE(IDL)@en[[[null]]]] to this attribute
removes the explicit entity base URI information
attached to the [CODE(DOMi)@en[[[EntityReference]]]]
object entirely and never restores the original 
entity base URI set during the tree construction, 
if any.  To synchronize entity base URI with that 
of the [CODE(DOMi)@en[[[Entity]]]] objecet with
same [CODE(DOMa)@en[[[name]]]] attribute,
use [CODE(DOMm)@en[[[normalizeDocument]]]] method
on the [CODE(DOMi)@en[[[Document]]]].

[43]
The [DFN@en[[CODE(DOMa)@en[[[manakaiExternal]]]] attribute]]
of an [CODE(DOMi)@en[[[EntityReference]]]] object
represents whether the entity referenced by
the object is an external entity or not.

This attribute is read-write.
The type of this attribute is [CODE(IDL)@en[[[boolean]]]].

The getter [['''MUST''']] return the value of the flag
associated to this attribute.

The setter [['''MUST''']] throw a 
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]
[CODE(DOMi)@en[[[DOMException]]]] if the object 
is read-only.  Otherwise, it [['''MUST''']]
set the specified value to the flag associated
to this attribute.

;; Setting this attribute might make an object
inconsistent with the [CODE(DOMi)@en[[[Entity]]]]
object referenced by it,  Such inconsistence might
be fixed by the method [CODE(DOMm)@en[[[normalizeDocument]]]]
on the [CODE(DOMi)@en[[[Document]]]] object.

@@ TODO: DOM accessor to 
[CODE(InfoProp)@en[[[system identifier]]]],
[CODE(InfoProp)@en[[[public identifier]]]],
and [CODE(InfoProp)@en[[[declaration base URI]]]]
of an unexpanded entity reference information item.


* Extensions to the [CODE(DOMi)@en[Notation]] Interface


** Notation Identifiers

[39]
The [DFN@en[[CODE(DOMa)@en[[[publicId]]]] attribute]] and
the [DFN@en[[CODE(DOMa)@en[[[systemId]]]] attribute]]
of the [CODE(DOMi)@en[[[Notation]]]] interface is so
extended that they are read-write.
See >>37 for the complete definition.


** Parent

[51]
The 
[DFN@en[[CODE(DOMi)@en[[[ownerDocumentTypeDefinition]]]] attribute]]
of the [CODE(DOMi)@en[[[Notation]]]] interface
is defined at >>50.


* Extension to the [CODE(DOMi)@en[ProcessingInstruction]] Interface


** Base URI

[28] The [DFN@en[[CODE(DOMa)@en[[[manakaiBaseURI]]]] attribute]]
is added to the [CODE(DOMi)@en[[[ProcessingInstruction]]]]
interface as well as the [CODE(DOMi)@en[[[Element]]]]
interface.  See >>18 for details.

* The [CODE(DOMi)@en[DOMConfiguration]] interface

[FIG[
[92] 
[PRE(IDL code)[
[[partial]] [[interface]] [[DOMConfiguration]] {
  [[readonly]] [[attribute]] [[DOMString]][] [[parameterNames]];
};
]PRE]
]FIG]

[93] The [CODE(DOMa)@en[[[parameterNames]]]] attribute [['''MUST''']] return the [[read only array]]
of the parameter names ([CODE(DOM)@en[[[DOMString]]'''['''''']''']], not [CODE(DOMi)@en[[[DOMStringList]]]]
as specified in [[DOM3 Core]]), associated with the [[document]].  The attribute [['''MUST''']] returns
the same object every time it is invoked with same [[context object]].
The items [['''MUST''']] be sorted by code point order.

[94] The [CODE(DOMa)@en[[[domConfig]]]] attribute of the [CODE(DOMi)@en[[[Document]]]] interface
[['''MUST''']] return the same object every time it is invoked with same [[context object]].

[101] If a parameter is an [DFN[alias]] of another parameter, methods [CODE(DOMm)@en[[[getParameter]]]],
[CODE(DOMm)@en[[[setParameter]]]], and [CODE(DOMm)@en[[[canSetParameter]]]] [['''MUST''']] treat
those names as equivalent.

[97] The parameter [DFN[[CODE[[[manakai-create-child-element]]]]]]
specifies whether several [[Atom DOM]] attributes should create a child element if it is not exists.
The expected value type of the parameter is [[boolean]].
The default value is [[false]].
The parameter [DFN[[CODE[[[http://suika.fam.cx/www/2006/dom-config/create-child-element]]]]]]
is an alias of the parameter [CODE[[[manakai-create-child-element]]]].

[99] The parameter [DFN[[CODE[[[manakai-strict-document-children]]]]]]
specifies whether the constraints on [CODE(DOMi)@en[[[Document]]]] node's child nodes should not
be relaxed or not.
The expected value type of the parameter is [[boolean]].
The default value is [[true]].
The parameter [DFN[[CODE[[[http://suika.fam.cx/www/2006/dom-config/strict-document-children]]]]]]
is an alias of the paramter [CODE[[[manakai-strict-document-children]]]].

[132] The parameter [DFN[[CODE(DOM)[[[manakai-allow-doctype-children]]]]]]
specifies whether the [CODE(DOMi)@en[[[DocumentType]]]] node can contain [CODE(DOMi)@en[[[ProcessingInstruction]]]]
nodes as children or not.
The expected value type of the parameter is [[boolean]].
The default value is [[false]].

[174] For the purpose of [[conformance checker]]s, child nodes of [CODE(DOMi)@en[[[Document]]]] and
[CODE(DOMi)@en[[[DocumentType]]]] [['''MUST''']] conform to the constraints for node trees
<http://dom.spec.whatwg.org/#node-tree>, whatever values configuration parameters are set to.

[95] The parameter [DFN[[CODE[[[http://suika.fam.cx/www/2006/dom-config/clone-entity-reference-subtree]]]]]]
specifies whether the entity reference subtree should be cloned from corresponding entity node upon
creation of the node.
The expected value type of the parameter is [[boolean]].
If it is the [[DOM3]] implementation, the default value is [[true]].  Otherwise, the default value is
[[false]].

[96] The parameter [DFN[[CODE[[[http://suika.fam.cx/www/2006/dom-config/dtd-attribute-type]]]]]]
specifies whether the [[DTD]] attribute type should be set to the [CODE(DOMa)@en[[[schemaTypeInfo]]]]
attribute of the newly created attribute node or not.
The expected value type of the parameter is [[boolean]].
If it is the [[DOM3]] implementation, the default value is [[true]].  Otherwise, the default value is
[[false]].

[98] The parameter [DFN[[CODE[[[http://suika.fam.cx/www/2006/dom-config/dtd-default-attribute]]]]]]
specifies whether the [[DTD]] default attributes should be automatically set to elements or not.
The expected value type of the parameter is [[boolean]].
If it is the [[DOM3]] implementation, the default value is [[true]].  Otherwise, the default value is
[[false]].

[100] The parameter [DFN[[CODE[[[http://suika.fam.cx/www/2006/dom-config/xml-id]]]]]]
specifies whether the processing of the [CODE(XMLa)@en[[[xml:id]]]] attribute should be enabled or not.
The expected value type of the parameter is [[boolean]].
If it is the [[DOM3]] implementation, the default value is [[true]].  Otherwise, the default value is
[[false]].

[133] If the [CODE(DOM)[[[manakai-strict-document-children]]]] configuration parameter is set to
[[true]], the [[pre-insert]] operation and the [[replace]] operation on the [[document]]
[['''MUST NOT''']] throw a "[CODE(DOM)[[[HierarchyRequestError]]]]" exception for [[node tree]]'s 
constraints on node types in following cases:
- The type of [VAR@en[parent]] is [CODE(DOMi)@en[[[Document]]]] and the type of [VAR@en[node]] is one of:
[CODE(DOMi)@en[[[Element]]]], [CODE(DOMi)@en[[[DocumentType]]]], [CODE(DOMi)@en[[[Comment]]]],
[CODE(DOMi)@en[[[ProcessingInstruction]]]], and [CODE(DOMi)@en[[[Text]]]].
- The type of [VAR@en[parent]] is [CODE(DOMi)@en[[[Document]]]] and the type of [VAR@en[node]] is
[CODE(DOMi)@en[[[DocumentFragment]]]] whose children are one of: 
[CODE(DOMi)@en[[[Element]]]], [CODE(DOMi)@en[[[DocumentType]]]], [CODE(DOMi)@en[[[Comment]]]],
[CODE(DOMi)@en[[[ProcessingInstruction]]]], and [CODE(DOMi)@en[[[Text]]]].

[134] If the [CODE(DOM)[[[manakai-allow-doctype-children]]]] configuration parameter of the
[[node document]] is set to [[true]], the [[pre-insert]] operation and the [[replace]] operation on
the [CODE(DOMi)@en[[[DocumentType]]]] node [['''MUST NOT''']] throw a "[CODE(DOM)[[[HierarchyRequestError]]]]"
exception for [[node tree]]'s constraints on node types in following cases:
- The type of [VAR@en[parent]] is [CODE(DOMi)@en[[[Document]]]] and the type of [VAR@en[node]] is 
[CODE(DOMi)@en[[[ProcessingInstruction]]]].
- The type of [VAR@en[parent]] is [CODE(DOMi)@en[[[Document]]]] and the type of [VAR@en[node]] is
[CODE(DOMi)@en[[[DocumentFragment]]]] whose children are [CODE(DOMi)@en[[[ProcessingInstruction]]]].

[135] If the [CODE(DOM)[[[manakai-strict-document-children]]]] configuration parameter is set to
[[true]], the [CODE(DOMa)@en[[[textContent]]]] attribute of the [CODE(DOMi)@en[[[Document]]]]
object [['''MUST''']] act as if the [[context object]] were a [CODE(DOMi)@en[[[DocumentFragment]]]]
node.

* Extension to the [CODE(DOMi)@en[[[DOMLocator]]]] interface

[22]
The [DFN@en[[CODE(DOMa)@en[[[utf32Offset]]]] attribute]]
represents the [[UTF-32]] offset into the input source
the [CODE(DOMi)@en[[[DOMLocator]]]] is pointing to.

The type of this attribute is [CODE(IDL)@en[[[long]]]].
This attribute is read-only.

The getter [['''MUST''']] return the [[UTF-32]] offset
specified when the [CODE(DOMi)@en[[[DOMLocator]]]]
object is created.  If no such information is provided,
then [CODE(IDL)@en[[[-1]]]] [['''MUST''']] be returned.

* Extensions to the [CODE(DOMi)@en[TextTrack]] interface

[59] 
[PRE(IDL code)[
partial interface TextTrack {
  readonly attribute boolean manakaiIsInvalid;
  readonly attribute TextTrackCueList manakaiAllCues;
  TextTrack manakaiCloneTrack();
};
]PRE]

[60] The [DFN[[CODE(DOMa)@en[[[manakaiIsInvalid]]]]]] attribute of the 
[CODE(DOMi)@en[[[TextTrack]]]] object, on getting, [['''MUST''']]
return true if the track has been created by a [[WebVTT parser]]
and the [[WebVTT parser]] has reported that the [[WebVTT file]] from which 
the track object was created cannot be successfully processed as WebVTT.  
Otherwise, it [['''MUST''']] return false.

;; For the purpose of this method, a [[WebVTT]] file is invalid if it does
not contain the WebVTT signature such that the [[WebVTT parser]] does not
continue to parse the file.  Any other conformance error does not cause
the attribute return true.

[61] The [DFN[[CODE(DOMa)@en[[[manakaiAllCues]]]]]] attribute of the
[CODE(DOMi)@en[[[TextTrack]]]] object, on getting, [['''MUST''']]
return the [[live]] list that contains the cues found in the track,
whether active or not, or effective or not.

[62] The [DFN[[CODE(DOMm)@en[[[manakaiCloneTrack]]]]]] method of the 
[CODE(DOMi)@en[[[TextTrack]]]] object [['''MUST''']] return a new
[CODE(DOMi)@en[[[TextTrack]]]] object.  The new object [['''MUST''']]
have the same values as the original object for the attributes:
[CODE(DOMa)@en[[[kind]]]], [CODE(DOMa)@en[[[label]]]],
[CODE(DOMa)@en[[[language]]]], [CODE(DOMa)@en[[[mode]]]], and
[CODE(DOMa)@en[[[manakaiIsInvalid]]]].  The [CODE(DOMa)@en[[[manakaiAllCues]]]]
attribute of the new object [['''MUST''']] have a new [CODE(DOMi)@en[[[TextTrackCueList]]]]
object, containing the clones of the cues in the [CODE(DOMa)@en[[[manakaiAllCues]]]]
list of the original object, in order.  The clones [['''MUST''']] be the object
that would be created by the [CODE(DOMm)@en[[[manakaiCloneCue]]]] method of the cues,
with their [CODE(DOMa)@en[[[track]]]] attributes set to the new [CODE(DOMi)@en[[[TextTrack]]]]
object.

* Extensions to the [CODE(DOMi)@en[TextTrackCue]] interface

[56] 
[PRE(IDL code)[
partial interface TextTrackCue {
  readonly attribute long manakaiLine;
  readonly attribute long manakaiColumn;
  TextTrackCue manakaiCloneCue();
};
]PRE]

[57] The [DFN[[CODE(DOMa)@en[[[manakaiLine]]]]]] attribute of the 
[CODE(DOMi)@en[[[TextTrackCue]]]] object, on getting, [['''MUST''']]
return the line number in the original resource at which the cue
is declared, if available, or the value -1, otherwise.

[58] The [DFN[[CODE(DOMa)@en[[[manakaiColumn]]]]]] attribute of the 
[CODE(DOMi)@en[[[TextTrackCue]]]] object, on getting, [['''MUST''']]
return the column number in the original resource at which the cue
is declared, if available, or the value -1, otherwise.

[63] The [DFN[[CODE(DOMm)@en[[[manakaiCloneCue]]]]]] method of the
[CODE(DOMi)@en[[[TextTrackCue]]]] object [['''MUST''']] return a new
[CODE(DOMi)@en[[[TextTrackCue]]]] object.  The new object [['''MUST''']]
have the same values as the original object for the attributes:
[CODE(DOMa)@en[[[id]]]], [CODE(DOMa)@en[[[startTime]]]],
[CODE(DOMa)@en[[[endTime]]]], [CODE(DOMa)@en[[[pauseOnExit]]]],
[CODE(DOMa)@en[[[vertical]]]], [CODE(DOMa)@en[[[snapToLines]]]],
[CODE(DOMa)@en[[[line]]]], [CODE(DOMa)@en[[[position]]]], [CODE(DOMa)@en[[[size]]]],
[CODE(DOMa)@en[[[align]]]], and [CODE(DOMa)@en[[[text]]]].

* The [CODE(DOMi)@en[URIReference]] interface

[DEL[
[FIG[
[105] 
[PRE(IDL code)[
[[partial]] [[interface]] [[DOMImplementation]] {
  [[URIReference]] [[createURIReference]](([[DOMString]] or [[URIReference]]) url);
};

[NoInterfaceObject]
[[interface]] [[URIReference]] {
  [[attribute]] [[DOMString]] [[uriReference]];
  [[attribute]] [[DOMString]] [[uriScheme]];
  [[attribute]] [[DOMString]] [[uriAuthority]];
  [[attribute]] [[DOMString]] [[uriUserinfo]];
  [[attribute]] [[DOMString]] [[uriHost]];
  [[attribute]] [[DOMString]] [[uriPort]];
  [[attribute]] [[DOMString]] [[uriPath]];
  [[attribute]] [[DOMString]] [[uriQuery]];
  [[attribute]] [[DOMString]] [[uriFragment]];
  [[DOMString]][] [[getURIPathSegment]]([[unsigned long]] index);
  [[void]] [[setURIPathSegment]]([[unsigned long]] index, [[DOMString]] newValue);
  [[boolean]] [[isURI]]();
  [[boolean]] [[isURI3986]]();
  [[boolean]] [[isIRI]]();
  [[boolean]] [[isIRI3987]]();
  [[boolean]] [[isRelativeReference]]();
  [[boolean]] [[isRelativeReference3986]]();
  [[boolean]] [[isRelativeIRIReference]]();
  [[boolean]] [[isRelativeIRIReference3987]]();
  [[boolean]] [[isURIReference]]();
  [[boolean]] [[isURIReference3986]]();
  [[boolean]] [[isIRIReference]]();
  [[boolean]] [[isIRIReference3987]]();
  [[boolean]] [[isAbsoluteURI]]();
  [[boolean]] [[isAbsoluteURI3986]]();
  [[boolean]] [[isAbsoluteIRI]]();
  [[boolean]] [[isAbsoluteIRI3987]]();
  [[boolean]] [[isEmptyReference]]();
  [[URIReference]] [[getURIReference]]();
  [[URIReference]] [[getURIReference3986]]();
  [[URIReference]] [[getIRIReference]]();
  [[URIReference]] [[getIRIReference3987]]();
  [[URIReference]] [[getAbsoluteReference]](([[DOMString]] or [[URIReference]]) base, any opt...);
  [[URIReference]] [[getAbsoluteReference3986]](([[DOMString]] or [[URIReference]]) base, any opt...);
  [[URIReference]] [[getAbsoluteReference3987]](([[DOMString]] or [[URIReference]]) base, any opt...);
  [[boolean]] [[isSameDocumentReference]](([[DOMString]] or [[URIReference]]) base);
  [[boolean]] [[isSameDocumentReference3986]](([[DOMString]] or [[URIReference]]) base);
  [[boolean]] [[getRelativeReference]](([[DOMString]] or [[URIReference]]) base);
  [[URIReference]] [[cloneURIReference]]();
};
]PRE]
]FIG]

[106] The [DFN[[CODE(DOMm)@en[[[createURIReference]]]]]] [[method]] [['''MUST''']] run the following steps:
[FIG[
= If [VAR@en[url]] is a [CODE(DOMi)@en[[[URIReference]]]] object, let [VAR@en[url]] be the [[url]]
of [VAR@en[url]].
= Create a new [CODE(DOMi)@en[[[URIReference]]]] object whose [[url]] is [VAR[url]] and return the object.
]FIG]

[107] In [[DOM Perl Binding]], [VAR@en[url]] [['''MAY''']] be a reference to the string.
It [['''MUST''']] be dereferenced before the aforementioned steps are invoked.

[110] The [DFN[[CODE(DOMi)@en[[[URIReference]]]]]] object represents a [[URL]].  It has the associated [[url]].

[108] The [DFN[[CODE(DOMa)@en[[[uriReference]]]]]] attribute of the [CODE(DOMi)@en[[[URIReference]]]]
object, on getting, [['''MUST''']] return the [[url]] of the [[context object]].
On setting, the attribute [['''MUST''']] set the [[url]] of the [[context object]] to the new value.

[109] In [[DOM Perl binding]], the [CODE(perl)@en[[[stringify]]]] method of the 
[CODE(DOMi)@en[[[URIReference]]]] object [['''MUST''']] return the [[url]] of the [[context object]].

[111] Attributes [DFN[[CODE(DOMa)@en[[[uriScheme]]]]]], [DFN[[CODE(DOMa)@en[[[uriAuthority]]]]]],
[DFN[[CODE(DOMa)@en[[[uriUserinfo]]]]]], [DFN[[CODE(DOMa)@en[[[uriHost]]]]]],
[DFN[[CODE(DOMa)@en[[[uriPort]]]]]], [DFN[[CODE(DOMa)@en[[[uriPath]]]]]],
[DFN[[CODE(DOMa)@en[[[uriQuery]]]]]], and [DFN[[CODE(DOMa)@en[[[uriFragment]]]]]] corresponding to
scheme, authority, userinfo, hostname, port, path, query, and fragment components respectively.
On getting, these attributes [['''MUST''']] return the corresponding component of the [[url]]
of the context object, not including delimiters before or after the component, if any, or 
[[null]] otherwise.
On setting, these attributes [['''MUST''']] replace the corresponding component by the new value,
if the new value is syntactically sound value as that component, or do nothing, otherwise.
@@ Need more precious definition.

[112] The [DFN[[CODE(DOMm)@en[[[getURIPathSegment]]]]]] method of the [CODE(DOMi)@en[[[URIReference]]]]
object [['''MUST''']] return the path segment of the [[url]] of the [[context object]] with the index
specified as the argument.  The path segments of the URL is the components of the path separated by a
[CODE(char)[[[/]]]] character.  If the path segment with the specified index is not found,
[[null]] [['''MUST''']] be returned instead.

[113] The [DFN[[CODE(DOMm)@en[[[setURIPathSegment]]]]]] method of the [CODE(DOMi)@en[[[URIReference]]]]
object [['''MUST''']] set the path segment of the [[url]] of the [[context object]] with the index
specified by the first argument [['''MUST''']] be replaced or added by the value specified
as the second argument.  If the index is greater than the number of path segments, the path
segments with indexes greater than or equal to the number of the path segments and less than
the specified index [['''MUST''']] be set to the empty string.

@@ [114] Define methods; In DOM Perl Binding, string arguments can be scalar references.

[115] In [[DOM Perl Binding]], the [DFN[[CODE(DOMm)@en[[[clone]]]]]] [[method]] [['''MUST''']]
act as if the [CODE(DOMm)@en[[[cloneURIReference]]]] [[method]] has been invoked.

[116] In [[DOM Perl Binding]], the [CODE(perl)[[[eq]]]] operator on the [CODE(DOMi)@en[[[URIReference]]]]
object [['''MUST''']] compare the [[url]] of the [[context object]] with the other value.
]DEL]

* The [CODE(DOMi)@en[InternetMediaType]] interface

[DEL[
[FIG[
[121] 
[PRE(IDL code)[
[[partial]] [[interface]] [[DOMImplementation]] {
  [[InternetMediaType]] [[createInternetMediaType]]([[DOMString]] type, [[DOMString]] subtype);
};

[NoInterfaceObject]
[[interface]] [[InternetMediaType]] {
  [[stringifier]] [[readonly]] [[attribute]] [[DOMString]] [[imtText]];
  [[readonly]] [[attribute]] [[DOMString]] [[type]];
  [[attribute]] [[DOMString]] [[topLevelType]];
  [[attribute]] [[DOMString]] [[subtype]];
  [[readonly]] [[attribute]] [[unsigned long]] [[parameterLength]];
  [[DOMString]]? [[getAttribute]]([[unsigned long]] index);
  [[void]] [[setAttribute]]([[unsigned long]] index, [[DOMString]] attr);
  [[DOMString]]? [[getValue]]([[unsigned long]] index);
  [[void]] [[setValue]]([[unsigned long]] index, [[DOMString]] value);
  [[DOMString]]? [[getParameter]]([[DOMString]] attr);
  [[void]] [[setParameter]]([[DOMString]] attr, [[DOMString]] value);
  [[void]] [[addParameter]]([[DOMString]] attr, [[DOMString]] value);
  [[void]] [[removeParameter]]([[DOMString]] attr);
};
]PRE]
]FIG]

[122] The [DFN[[CODE(DOMi)@en[[[InternetMediaType]]]]]] object represents a [[MIME type]].
It has associated [[type]], [[subtype]], and ordered list of parameter name/value pairs.
The [[type]], [[subtype]], and parameter names [['''MUST''']] be [[converted to ASCII lowercase]]
when it is set.

[123] The [CODE(DOMm)@en[[[createInternetMediaType]]]] method [['''MUST''']]
return a new [CODE(DOMi)@en[[[InternetMediaType]]]] object whose [[type]] is set to the first argument,
whose [[subtype]] is set to the second argument, and the parameters is set to empty.

[124] For the [[DOM Perl Binding]], the [CODE(perl)@en[[[cmp]]]] operation [['''MUST''']] compare
the [[stringifier]]'s return value with the other value.

[125] The [CODE(DOMa)@en[[[imtText]]]] attribute [['''MUST''']] return the serialized representation
of the [[MIME type]].
@@ Need to define serialization.

[126] The [CODE(DOMa)@en[[[type]]]] attribute [['''MUST''']] return the serialized representation
of the [[MIME type]] without parameters.
@@ Need to define serialization.

[127] The [CODE(DOMa)@en[[[topLevelType]]]] attribute, on getting, [['''MUST''']] return the [[type]]
of the [[context object]].  On setting, it [['''MUST''']] set the [[type]] of the [[context object]].

[128] The [CODE(DOMa)@en[[[subtype]]]] attribute, on getting, [['''MUST''']] return the [[subtype]]
of the [[context object]].  On setting, it [['''MUST''']] set the [[subtype]] of the [[context object]].

@@ Methods...
]DEL]

* New configuration parameters


** Loose document children

[14]
The [DFN@en[configuration parameter [CODE(URI)@en[[[http://suika.fam.cx/www/2006/dom-config/strict-document-children]]]]]]
can be used to force the implementation to obey DOM
Level 3 Core rule for children of [CODE(DOMi)@en[[[Document]]]]
nodes.

;; Note that this configuration parameter does
affect operations only ''after'' it is set.
Changing the configuration parameter value
itself does not mutate the underlying document tree
even if the tree violate the rule applied under
the new value.

@@ The definition is incomplete.

[24]
If the parameter is set to [CODE(IDL)@en[[[false]]]],
the getter of the [CODE(DOMa)@en[[[textContent]]]]
attribute of a [CODE(DOMi)@en[[[Document]]]] object
[['''MUST''']] behave as if it were a
[CODE(DOMi)@en[[[DocumentFragment]]]] object,
except that the concatenation process [['''MUST''']]
ignore any [CODE(DOMi)@en[[[DocumentType]]]] object.

If the parameter is set to [CODE(IDL)@en[[[false]]]],
the setter of the [CODE(DOMa)@en[[[textContent]]]]
attribute of a [CODE(DOMi)@en[[[Document]]]] object
[['''MUST''']] behave as if it were a
[CODE(DOMi)@en[[[DocumentFragment]]]] object.

* The [CODE(DOMi)@en[ParentNode]] interface

[177] Following members are moved to the [CODE(DOMi)@en[[[ParentNode]]]] interface.

[FIG[
[175] 
[PRE(IDL code)[
partial interface [[ParentNode]] {
  attribute [[DOMString]] [[innerHTML]];
  HTMLCollection getElementsByTagName(DOMString localName);
  HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
  HTMLCollection getElementsByClassName(DOMString classNames);
  [[NodeList]] [[getItems]](optional [[DOMString]] typeNames = "");
};
]PRE]
]FIG]

[143] The [CODE(DOMa)@en[[[innerHTML]]]] attribute of the [CODE(DOMi)@en[[[DocumentFragment]]]] object
[['''MUST''']] act as if that were the [CODE(HTMLe)@en[[[body]]]] element in the [[HTML namespace]].

;; [146] The [CODE(HTMLe)@en[[[body]]]] element is used here such that this definition is consistent
with the [CODE(DOMa)@en[[[outerHTML]]]] attribute.

[154] Methods [CODE(DOMm)@en[[[getElementsByClassName]]]], [CODE(DOMm)@en[[[getElementsByTagName]]]], and
[CODE(DOMm)@en[[[getElementsByTagNameNS]]]] of the [CODE(DOMi)@en[[[DocumentFragment]]]] object [['''MUST''']]
act as if those methods of the [CODE(DOMi)@en[[[Element]]]] interface.

[176] The [CODE(DOMm)@en[[[getItems]]]] method [['''MUST''']] return the node list containing elements
that create top-level microdata items in the subtree rooted by the [[context object]] (inclusive).
The method [['''MUST''']] return a [[static]] node list.

;; [178] This is a [[willful violation]] to the [[HTML Standard]].

* Parsing and Serialization

@@ [145] Need to define XML parsing

[147] The steps to [[produce an HTML serialization]] or [[produce an XML serialization]] [['''MUST''']] be
defined as following:
- If the node is [CODE(DOMi)@en[[[Element]]]], [CODE(DOMi)@en[[[Text]]]], [CODE(DOMi)@en[[[Comment]]]], or
[CODE(DOMi)@en[[[ProcessingInstruction]]]]: Return the result of running the [[HTML fragment serialization algorithm]]
or the [[XML fragment serialization algorithm]], respectively, on a fictional node whose only child is
the node.
- If the node is [CODE(DOMi)@en[[[DocumentType]]]]: Return the result of running the [[HTML fragment serialization algorithm]]
or the [[XML fragment serialization algorithm]], respectively, on a fictional document node whose only children are
the node and an element and then remove the serialization of the element from the string returned by the algorithm.

[148] If the [CODE(DOMa)@en[[[serializeToString]]]] method is invoked with an [CODE(DOMi)@en[[[Attr]]]],
[CODE(DOMi)@en[[[ElementTypeDefinition]]]], [CODE(DOMi)@en[[[AttributeDefinition]]]], [CODE(DOMi)@en[[[Entity]]]],
or [CODE(DOMi)@en[[[Notation]]]] node, then a "[CODE(DOMe)@en[[[NotSupportedError]]]]" exception [['''MUST''']]
be [[thrown]].

* Events

[FIG[
[158]
[PRE(IDL code)[
partial interface [[Event]] {
  readonly attribute [[boolean]] [[manakaiDispatched]];
  readonly attribute [[boolean]] [[manakaiImmediatePropagationStopped]];
  readonly attribute [[boolean]] [[manakaiPropagationStopped]];
};
]PRE]
]FIG]

[159] The [DFN[[CODE(DOMa)@en[[[manakaiDispatched]]]]]] attribute of the [CODE(DOMi)@en[[[Event]]]]
interface [['''MUST''']] return the [[dispatch flag]] of the [[context object]].

[160] The [DFN[[CODE(DOMa)@en[[[manakaiImmediatePropagationStopped]]]]]] attribute of the [CODE(DOMi)@en[[[Event]]]]
interface [['''MUST''']] return whether the [[stop immediate propagation flag]] of the [[context object]]
is set or not.

[161] The [DFN[[CODE(DOMa)@en[[[manakaiPropagationStopped]]]]]] attribute of the [CODE(DOMi)@en[[[Event]]]]
interface [['''MUST''']] return whether the [[stop propagation flag]] of the [[context object]]
is set or not.

[FIG[
[162] 
[PRE(IDL code)[
partial interface [[MouseEvent]] {
  readonly attribute [[boolean]] [[altGraphKey]];
};
partial interface [[KeyboardEvent]] {
  readonly attribute [[boolean]] [[altGraphKey]];
};
]PRE]
]FIG]

[163] The [CODE(DOMa)@en[[[altGraphKey]]]] [[attribute]] [['''MUST''']] return the return value
of the [CODE(DOMm)@en[[[getModifierState]]]] method on the [[context object]] with the argument [CODE[[[AltGraph]]]].

;; [164] Implemented by [[Chrome]].

[165] The [CODE(DOMm)@en[[[initKeyboardEvent]]]]] method of the [CODE(DOMi)@en[[[KeyboardEvent]]]]
interface [['''MUST''']] also recognize the key name [COCDE[[[AltGraph]]]] in its [CODE(DOMp)@en[modifiersListArg]]
argument.

* CSSOM

[FIG[
[166] 
[PRE(IDL code)[
partial interface [[StyleSheet]] {
  readonly attribute [[DOMString]] [[manakaiBaseURI]];
  readonly attribute [[DOMString]] [[manakaiInputEncoding]];
};

partial interface [[CSSStyleSheet]] {
  attribute [[DOMString]] [[cssText]];
  [[DOMString]]? [[manakaiLookupNamespaceURI]]([TreatNullAs=EmptyString] [[DOMString]] prefix);
  [[DOMString]]? [[manakaiLookupNamespacePrefix]]([TreatNullAs=EmptyString] [[DOMString]] namespace);
  [[boolean]] [[manakaiIsDefaultNamespace]]([TreatNullAs=EmptyString] [[DOMString]] namespace);
};
]PRE]
]FIG]

[167] The [DFN[[CODE(DOMa)@en[[[manakaiBaseURI]]]]]] attribute of the [CODE(DOMi)@en[[[StyleSheet]]]]
interface [['''MUST''']] return the [[base URL]] associated with the style sheet when it is created.

[168] The [DFN[[CODE(DOMa)@en[[[manakaiInputEncoding]]]]]] attribute of the [CODE(DOMi)@en[[[StyleSheet]]]]
interface [['''MUST''']] return the [[encoding name]] [SRC[[[Encoding Standard]]]] used to interpret the style sheet.
If the style sheet is created from a character sequence (rather than byte sequence), it [['''MUST''']]
return [CODE(charset)@en[[[utf-8]]]] instead.

[169] On getting, the [CODE(DOMa)@en[[[cssText]]]] attribute [['''MUST''']] return the [CODE(DOMa)@en[[[cssText]]]]
attribute values of the rules contained in the [CODE(DOMa)@en[[[cssRules]]]] of the [CODE(DOMi)@en[[[CSSStyleSheet]]]]
object, in same order, separated by a [CODE(char)[[[U+000A]]]] character.

@@ Setter is not yet defined.

[170] The [DFN[[CODE(DOMa)@en[[[manakaiLookupNamespaceURI]]]]]] method of the [CODE(DOMi)@en[[[CSSStyleSheet]]]]
interface [['''MUST''']] return the namespace name of the namespace prefix specified by the argument, if any,
or null otherwise.  If there are multiple [CODE(CSS)@en[[[@namespace]]]] at-rules in the style sheet,
only the last one takes effect by definition.  If the argument is the empty string, namespace name
of the default namespace, if any, is returned instead.

[171] The [DFN[[CODE(DOMa)@en[[[manakaiLookupNamespacePrefix]]]]]] method of the [CODE(DOMi)@en[[[CSSStyleSheet]]]]
interface [['''MUST''']] return the namespace prefix bound to the namespace which is equal to the argument, if any, 
or null otherwise.  If there are more than one namespace prefixes bound to the namespace, the namespace prefix
declared later in the list of rules in the style sheet [['''MUST''']] be returned.  Note that any
[CODE(CSS)@en[[[@namespace]]]] at-rules with no prefix is ignored for the purpose of this method.

[172] The [DFN[[CODE(DOMa)@en[[[manakaiIsDefaultNamespace]]]]]] method of the [CODE(DOMi)@en[[[CSSStyleSheet]]]]
interface [['''MUST''']] return true if the [[default namespace]] of the style sheet [SRC[[[css-namespaces]]]]
is equal to the argument, or false otherwise.

;;
[173] A namespace name consist of the empty string represents the null namespace in CSS Namespaces [SRC[[[css-namespaces]]]].

* Non-browser script support

[156] When the steps are invoked in the context where the "[[entry script]]" concept is not defined by any other
specification (e.g. when a non-browser script invokes a DOM method), the [[base URL]] of the [[entry script]] 
[['''MUST''']] be [CODE(URI)@en[[[about:blank]]]] unless otherwise specified by an [[applicable specification]].

* DOM3 bug fixes

[DEL[
[71] The [DFN[[CODE(DOMm)@en[[[createAttribute]]]]]] method of the [CODE(DOMi)@en[[[Document]]]] interface
[['''MUST''']] run the following steps:
[FIG[
= Let [VAR@en[localName]] be the argument.
= If [VAR@en[localName]] does not match the XML [CODE[[[Name]]]] production, throw an 
"[CODE[[[InvalidCharacterError]]]]" exception and terminate these steps.
= Return a new [[attribute]] with namespace set to [[null]], local name set to [VAR[localName]], 
[[node document]] set to the [[context object]], [[owner element]] set to null, and
[[value]] set to the empty string.
]FIG]

[72] The [DFN[[CODE(DOMm)@en[[[createAttributeNS]]]]]] method of the [CODE(DOMi)@en[[[Document]]]] interface
[['''MUST''']] act as if the [CODE(DOMm)@en[[[createElementNS]]]] method was invoked, except that
a new [[attribute]], instead of a new [[element]], [['''MUST''']] be created.  The [[value]] of the newly 
created [[attribute]] [['''MUST''']] be the empty string.
]DEL]

[73] Methods [DFN[[CODE(DOMm)@en[[[createEntityReference]]]]]] and [DFN[[CODE(DOMm)@en[[[createCDATASection]]]]]]
of the [CODE(DOMi)@en[[[Document]]]] interface [['''MUST''']] [[throw]] a
"[CODE[[[NotSupportedError]]]]" [[exception]].

[DEL[
[74] If the [CODE(DOMm)@en[[[getAttributeNode]]]] method of the [CODE(DOMi)@en[[[Element]]]] interface
founds multiple attributes, it [['''MUST''']] return the first attribute.
If the document is an [[HTML document]] and the [[context object]] is in the [[HTML namespace]], 
the argument to the method [['''MUST''']] be [[converted to ASCII lowercase]] first.

[75] The [DFN[[CODE(DOMm)@en[[[setAttributeNode]]]]]] method and the [DFN[[CODE(DOMm)@en[[[setAttributeNodeNS]]]]]]
method of the [CODE(DOMi)@en[[[Element]]]] interface [['''MUST''']] run these steps:
[FIG[
= Let [VAR@en[newAttr]] be the argument.
= If the [[owner element]] of [VAR@en[newAttr]] is not [[null]] and is different from the [[context object]],
[[throw]] an "[CODE(DOMe)@en[[[InUseAttributeError]]]]" [[exception]] and abort these steps.
= [[Adopt]] [VAR@en[newAttr]].
= If the [[context object]] has the [[attribute]] whose [[namespace]] and [[local name]] are equal to
those of [VAR@en[newAttr]], let [VAR@en[oldAttr]] be the attribute and set the [[owner element]]
of [VAR@en[oldAttr]] to [[null]].  Otherwise, let [VAR@en[oldAttr]] be [[null]].
= If [VAR[oldAttr]] is [[null]], append [VAR@en[newAttr]] to the [[attributes]] of the [[context object]].
= Otherwise, if [VAR[oldAttr]] is not [[null]], replace [VAR@en[oldAttr]] in the [[attributes]]
of the [[context object]] by [VAR@en[newAttr]].
= Set the [[owner element]] of [VAR@en[newAttr]] to the [[context object]].
= If [VAR@en[oldAttr]] is null, [[attribute is set]] and [[attribute is added]].
= Otherwise, [[attribute is set]] and [[attribute is changed]].
= Return [VAR@en[oldAttr]].

@@ MutationEvent integration is necessary...
]FIG]

[149] If the [CODE(DOMm)@en[[[removeAttributeNode]]]] method removes an attribute, then 
[[attribute is removed]] just before the method returns a node.

[88] The [CODE(DOMm)@en[[[setNamedItem]]]] method and the [CODE(DOMm)@en[[[setNamedItemNS]]]]
method of the [CODE(DOMi)@en[[[NamedNodeMap]]]] interface [['''MUST''']] act in the
consistent way with these methods.
]DEL]

[DEL[
[79] The [DFN[[CODE(DOMm)@en[[[isSameNode]]]] method]] of the [CODE(DOMi)@en[[[Node]]]] interface
[['''MUST''']] return [[false]] if the argument is [[null]].

[FIG[
[PRE(IDL code)[
[[partial]] [[interface]] [[Node]] {
  [[boolean]] [[isSameNode]] ([[Node]]? other);
};
]PRE]
]FIG]
]DEL]

[142] The node has a [[strong reference]] to each of user data and user data handler associated with
the node using the [CODE(DOMm)@en[[[setUserData]]]] method until they has been removed from the node
by another invocation of the method with the same name argument.

[157] For the purpose of the [CODE(DOMa)@en[[[media]]]] IDL attribute, the attribute has no default value.

* Implementation-specific requirements

[155] When a method on an object may or may not return the same [CODE(DOMi)@en[[[NodeList]]]] or 
[CODE(DOMi)@en[[[HTMLCollection]]]] object as returned by the earlier calls, then the same object
[['''MUST''']] be returned.

[DEL[
[69] Steps [[list of elements with local name [VAR[localName]]]],
[[list of elements with namespace namespace and local name [VAR[localName]]]], and
[[list of elements with class names [VAR[classNames]]]] [['''MUST''']] always return
the same [CODE(DOMi)@en[[[HTMLCollection]]]] object as returned by the earlier calls with the 
same [[context object]] and argument.

;; [70] In [[DOM Standard]] this is optional.
]DEL]

[91] The [[document]] has the [DFN[[[strict error checking]]]] flag.  By default, the flag is set.
The [CODE(DOMa)@en[[[strictErrorChecking]]]] of the [CODE(DOMi)@en[[[Document]]]] interface
[SRC[DOM3CORE]], on getting, 
[['''MUST''']] return whether the [[strict error checking]] flag of the [[document]] is set or not.
On setting, the attribute [['''MUST''']] set the flag if the true value is assigned, or unset otherwise.

[129] Non-[[DOM3]] implementation [['''MUST''']] throw exceptions or report errors as specified by
relevant specifications, unless an [[applicable specification]] explicitly specifies the
applicability of the [[strict error checking]] flag.

;;
[35]
As specified in DOM Level 3 Core specification [SRC[DOM3CORE]],
a DOM3 implementation may choose not to throw an exception
when the [CODE(DOMa)@en[[[strictErrorChecking]]]] attribute
of the [CODE(DOMi)@en[[[Document]]]] object 
is set to [CODE(IDL)@en[[[false]]]].

[130] If the [[strict error checking]] flag of the [[node document]] is set,
for the purpose of setting [[name]], [[namespace]], [[namespace prefix]], [[target]], and/or [[local name]] of
a [[node]] or [[attribute]] only, the definitions of [CODE(XML)@en[[[Name]]]], [CODE(XML)@en[[[NCName]]]], and
[CODE(XML)@en[[[QName]]]] [['''MUST''']] be replaced by the following definition: "a string of one or more
[[Unicode code points]]".

[140] If the [[strict error checking]] flag of the [[node document]] is set,
for the purpose of setting the [[name]] of the [CODE(DOMi)@en[[[DocumentType]]]] node only,
the definition of [CODE(XML)@en[[[Name]]]] and [CODE(XML)@en[[[QName]]]] [['''MUST''']]
be replaced by the following definition: "a string of zero or more [[Unicode code points]]".

[136] If the [[strict error checking]] flag of the [[node document]] is set,
when a [[QName]] is split to obtain the optional namespace prefix and the local name,
- If the first character is the [CODE(charname)@en[[[COLON]]]] character, the [[namespace prefix]]]] is [[null]]
and the [[local name]] is the [[QName]].
- If the first [CODE(charname)@en[[[COLON]]]] character in the [[QName]] is the last character,
the [[namespace prefix]] is [[null]] and the [[local name]] is the [[QName]].

[131] If the [[strict error checking]] flag of the [[node document]] is set,
following tests, if any, [['''MUST''']] be skipped upon creation of elements and attributes,
or setting of the namespace prefix and [['''MUST NOT''']] throw an exception for them:
- When the namespace prefix or the qualified name is [CODE(XML)@en[[[xml]]]] or [CODE(XML)@en[[[xmlns]]]],
whether the namespace URL is appropriate or not.
- When the namespace URL is the [[XML namespace]] or the [[XMLNS namespace]], whether the namespace prefix or
the qualified name is appropriate or not.
- When the namespace prefix is not [[null]] while the [[local name]] is not [[null]],
whether the namespace URL is [[null]] or not.

[139] If the [[strict error checking]] flag of the [[node document]] is set,
the [CODE(DOMm)@en[[[createProcessingInstruction]]]] method [['''MUST''']] skip the test whether
the [[data]] contains [CODE[?>]] or not and [['''MUST NOT''']] throw an exception for it.

[137] If the [[strict error checking]] flag of the [[node document]] is set,
the [CODE(DOMa)@en[[[xmlVersion]]]] attribute of the [[document]], on setting, 
[['''MUST NOT''']] throw an exception because of the new value's invalidness and it
['''MUST''']] set the new value as the [[XML version]] of the document.

[138] If an operation is defined in terms of the [[XML version]] of the document or the
[CODE(XMLa)@en[[[xmlVersion]]]] attribute value but its behavior on occurrence of unknown XML version
is not defined, it [['''MUST''']] behave as if the [[XML version]] is [CODE[[[1.0]]]].

* New language binding (informative)

[29] [[manakai]] is a set of [[Perl]] modules
and it defines its own binding of [[DOM]].
For more information, see [[DOM Perl Binding]]
[MDPB].


* References


** Normative References

:[DOM3Core]:
[CITE@en[Document Object Model (DOM) Level 3 Core Specification Version 1.0]],
[[W3C]] Recommendation, 7 April 2004,
<http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407>.
The latest version of DOM Level 3 Core is avalable at
<http://www.w3.org/TR/DOM-Level-3-Core>.
(This version of the specification is referenced.)
:[HTML5]:
[CITE@en[HTML 5]], [[WHATWG]] Working Draft, work in progress,
<http://whatwg.org/html5>.
:[RFC 2119]:
[CITE@en[Key words for use in RFCs to Indicate Requirement Levels]],
[[IETF]], [[RFC 2119]], [[BCP 14]], March 2004,
<urn:ietf:rfc:2119>.
(This version of the specification is referenced.)
:[Infoset]:
[CITE@en[XML Information Set (Second Edition)]],
[[W3C]] Recommendation, 4 February 2004,
<http://www.w3.org/TR/2004/REC-xml-infoset-20040204>.
The latest version of XML Information Set is available at
<http://www.w3.org/TR/xml-infoset>.
(Latest version of the specifcation whose
maturity level is higher than Candidate Recommendation
is referenced.)
:[SelectorsAPI]:
[CITE@en[Selectors API]],
[[W3C]] Editor's Draft, 29 August 2007,
<http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&content-type=text/html;%20charset=utf-8>.
The latest published version of Selectors API is available at
<http://www.w3.org/TR/selectors-api/>.
(Latest version of the specifcation whose
maturity level is higher than Candidate Recommendation, if any,
or latest Editor's Draft is referenced.)

** Informative References

:[DOM2Traversal]:
[CITE@en[Document Object Model (DOM) Level 2 Traversal and Range Specification Version 1.0]],
[[W3C]] Recommendation, 13 November 2000,
<http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113>.
The latest version of DOM Level 2 Traversal and Range
is available at <http://www.w3.org/TR/DOM-Level-2-Traversal-Range>.
:[EBFD]:
@@ ECMAScript binding for DOM, [[W3C]] Editor's Draft.
:[MDPB]:
[CITE@en[manakai's DOM Perl binding]], work in progress,
[[DOM Perl Binding]].


* memo (informative)

[53]

@@

       - If they are <IF::tx|DocumentType>s and at least one of them
          has the <Feature::fe|XDoctype> feature, their <A::DTDef.elementTypes>
          <IF::NamedNodeMap>s are equal, i.e. they both has the
          <Feature::fe|XDoctype> feature and their <A::DTDef.elementTypes>
          are equal (as defined for <A::Node.attributes> except
          that they cannot be <DOM::null>), or the <A::DTDef.elementTypes>
          of the node that has the <Feature::fe|XDoctype> feature
          is empty (i.e. its <A::NamedNodeMap.length> is zero).
          <SRC::manakai>

        - If they are <IF::ETDef>s, their <A::ETDef.attributeDefinitions>
          <IF::NamedNodeMap>s are equal (as defined for
          <A::Node.attributes> except that they cannot be <DOM::null>).
          <SRC::manakai>

        - If they are <IF::ATDef>s, the numeric attributes
          <A::ATDef.declaredType> and <A::ATDef.defaultType> are equal.
          <SRC::manakai>

        - If they are <IF::ATDef>s, the <A::ATDef.allowedToken>
          <IF::c|DOMStringList>s are equal, i.e. they have
          the same <A::c|DOMStringList.length> and for each string
          that exists in one list there is a string that
          exists in the other list and is equal, although
          not necessarily at the same index.  In addition,
          the number of the items that are equal to a string in one list
          is equal to the number of such items in the other list.