[76] manakai DOM Extensions > Extensions to existing interfaces >
Interfaces implemented by Document
objects
Document interfacepartial interface Document { attribute DOMString inputEncoding; attribute DOMString? manakaiCharset; attribute boolean manakaiHasBOM; }; partial interface Entity { attribute DOMString inputEncoding; attribute DOMString? manakaiCharset; attribute boolean manakaiHasBOM; };
[17] The entity has the encoding. Unless otherwise specified, it is utf-8.
[58] On getting, the inputEncoding attribute of a Entity object MUST return the encoding of the
entity, using the same compatible name as the inputEncoding
attribute of the Document interface.
[56] On setting, the inputEncoding attribute of a Document
or Entity object MUST run the following steps:
[59] On getting, the charset attribute of the Document
interface MUST return the encoding of the document.
[26] The xmlEncoding attribute
of Document and
Entity interfaces is now read-write.
The setter of the xmlEncoding
MUST behave as if the following algorithm is performed:
Document and
its manakaiIsHTML flag is set to
true, then throw a
NOT_SUPPORTED_ERR
DOMException.NO_MODIFICATION_ALLOWED_ERR.null.[60] The manakaiCharset attribute of the Document
interface and the Entity interface represents the charset
information included in the Content-Type metadata of the resource from
which the document or entity has been created.
[61] For the Document object created by fetching a resource,
if the resource has the Content-Type metadata (i.e.
Content-Type header field or equivalent) including the
charset parameter whose definition is equivalent or subset of
at least one of text/* and XML MIME types' charset
parameter's definition, then the parameter value MUST be set to the charset metadata
of the document. Otherwise the charset metadata of the object MUST be initially
set to null.
[62] For the Entity object representing an external entity, if the
entity has been created from the resource which has the Content-Type metadata
including the
charset parameter whose definition is equivalent or subset of
at least one of text/* and XML MIME types' charset
parameter's definition, then the parameter value MUST be set to the charset metadata
of the entity. Otherwise the charset metadata of the object MUST be initially
set to null.
charset name that is compatible
with MIME's definition, then the value has to be converted such that the manakaiCharset
attribute exposes the MIME compatible name representing that character encoding.[63] On getting, the manakaiCharset attribute MUST
return the charset metadata of the context object.
[66] On setting, the manakaiCharset attribute MUST
set the charset metadata of the context object to the new value.
[67] The manakaiHasBOM attribute of the Document
and Entity interfaces represents whether the context object's byte representation
has the BOM or not. These objects has the has BOM flag, initially unset.
[68] When the Document object is created by fetching a resource,
or the Entity object is created by fetching a external entity,
if the resource is represented as byte sequence and starts with the BOM, then the
has BOM flag of the object MUST be set.
[69] The manakaiHasBOM attribute, on getting, MUST return the has BOM
flag is set or not. On setting, it MUST set the has BOM flag if the new value is true,
or unset the flag, otherwise.
partial interface Document { void manakaiSetURL(DOMString url); };
[74] The manakaiSetURL(url) method
of the Document interface MUST run
these steps:SyntaxError exception and abort these steps.
[15]
The manakaiEntityBaseURI attribute
contains the base DOM URI of the document entity.
The type of this attribute is DOMString.
This attribute is read-write.
If the Document has the base URI
information (in XML infoset terminology, the
base URI property),
then the getter MUST return that
base URI. Otherwise, the getter MUST
return the documentURI
of the Document, possibly
null. Note that these
result in returning a DOMString
that is not a legal absolute URI, if the base URI
information or documentURI
does not contain a legal absolute URI.
On setting, if the Document is read-only,
then a NO_MODIFICATION_ALLOWED_ERR
MUST be thrown. Otherwise,
if the new value is null,
then the base URI information, if any, is unset.
If the new value is non-null,
then the base URI information is set to that value.
Note that no lexical checking is performed
on that value. Note also that setting this attribute
does not affect on the documentURI
attribute.
It is expected that if the Document
is created from an XML document entity retrieved from an HTTP
entity, then the Content-Location:
and / or Content-Base: header fields,
if any, are reflected to this attribute.
[16]
The
allDeclarationsProcessed attribute
contains a value that represents whether the XML
processor has read the complete DTD when the
XML document is parsed. This attribute corresponding
to the all declarations processed
property of the document information item
in the XML Information Set.
complete or not,
or valid or not. In particular, modifications to the
DOM tree does not affect the value of this attribute.normalizeDocument method
and this attribute.The type of this attribute is boolean.
This attribute is read-write.
The getter MUST return the value.
On setting, if the Document is read-only,
then a NO_MODIFICATION_ALLOWED_ERR
DOMException
MUST be thrown. Otherwise,
it MUST set the value to the new value.
The createDocument method
MUST set the
allDeclarationsProcessed attribute
of the newly created Document
object as false.
If a Document object is
created from an XML information set,
the allDeclarationsProcessed
attribute of the Document object
MUST be set to the value of the
all declarations processed
property of the document information item.
If the property is set to true, then the attribute
MUST be set to true.
Otherwise, including the case the property is missing,
the attribute MUST be set to
false.
If a Document object is mapped
to an XML information set, then the
all declarations processed
property MUST be set to the value
of the allDeclarationsProcessed
attribute.
HTMLDocument interface[25] The manakaiIsHTML
attribute represents whether the Document
is an HTML document or not.
The type of this attribute is boolean.
This attribute is read-write.
The getter MUST return true
if and only if the Document
is an HTML document. Otherwise it MUST
return false.
[54] On setting, following steps MUST be performed:
true, run following substeps:text/html.application/xml.Document that has just
been created by createDocument is
not an HTML document, its manakaiIsHTML
is false.[53]
The manakaiCompatMode attribute
of the HTMLDocument interface
is a read-write attribute of type DOMString.
Its value represents the mode [HTML5] in which the document
is interpreted.
This attribute has three values:
no quirkslimited quirksquirksThis attribute MUST return one of three values listed above depending on the mode of the document. Note that XML documents are always in the no quirks mode.
On setting, the specified value MUST be set to the attribute if the specified value is one of three values listed above and the document is an HTML document. Otherwise, the attribute value MUST NOT be changed.
Document node created
by the createDocument method is an
XML document and is in the no quirks mode, therefore
its manakaiCompatMode attribute
value is no quirks.
A Document node created by an
HTML parser from an HTML document is in one
of three modes and its
manakaiCompatMode attribute
value is a value corresponding to the mode.manakaiIsHTML
attribute false reset the
mode to the no quirks mode.partial interface Document { readonly attribute HTMLHeadElement manakaiHead; readonly attribute HTMLHtmlElement manakaiHTML; attribute boolean manakaiIsSrcdoc; };
[71] The manakaiHead attribute of the document MUST
return the head element of the document.
[72] The manakaiHTML attribute of the document MUST
return the html element of the document.
[73] On getting, the manakaiIsSrcdoc attribute of the document MUST
return whether the document is an iframe srcdoc document or not.
On setting, if the attribute is invoked by an author script, it MUST do nothing.
Otherwise, the attribute MUST make the document
an iframe srcdoc document if the new value is true,
or not an iframe srcdoc document otherwise.
DocumentTraversal interface[13]
The manakaiCreateSerialWalker method
creates and returns a new SerialWalker
object.
This method takes four parameters:
root, whatToShow,
filter, and
entityReferenceExpansion.
The root parameter is
the node that will serve as the root for the
SerialWalker.
It is a Node.
The whatToShow flags and
the NodeFilter are not considered
when setting this value; any node type
will be accepted as the root.
The currentNode of the created
SerialWalker is initialized to
the root Node,
whether or not it is visible.
The root functions as a stopping
point for traversal method that look upwards
in the document structure, i.e. nextNode.
The root MUST NOT
be null. If it is, then
a NOT_SUPPORTED_ERR exception
MUST be thrown.
The whatToShow parameter
is the flags that specify which node types may appear
in the logical view of the tree presented by the
SerialWalker.
It is an unsigned short.
The set of the flags are defined in the
NodeFilter interface.
They can be combined using the binary OR
operation.
The filter parameter
is the NodeFilter to be used
with the created SerialWalker.
If null is set, then no filter is used.
The
entityReferenceExpansion parameter
parameter is the expandEntityReferences
flag of the created TreeWalker.
It is a boolean value.
If it is set to true,
then the contents of the EntityReference
nodes are presented in the logical view.
Otherwise, the contents of the EntityReference
nodes are not presented in the logical view.
The method returns a SerialWalker.
It MUST be a new SerialWalker
with following attributes:
inputEncodingattribute is originally defined by DOM3 Core and redefined here. Unlike in DOM3 Core, theinputEncodingattribute returnutf-8rather thannullif it is not available.