All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
#839
/ #838
#847
/ #838
#845
Thank you, @kboshold, @Ponynjaa, for your contributions.
hasAttributes
#804
#802
/ #803
#817
/ #819
DOM.compareDocumentPosition
#805
Thank you, @zorkow, @Ponynjaa, @WesselKroos, for your contributions.
#792
Thank you, @eglitise, for your contributions.
Thank you, @mureinik, for your contributions.
#748
/ #760
warning
(#759) #754
/ #759
#758
Thank you, @luffynando, @mattiasw, @JoinerDev, for your contributions.
Node
and ProcessingInstruction
types #725
/ #726
getElements*
methods return LiveNodeList<Element>
#731
/ #734
Node
props #728
, triggered by unclosed #724
Thank you, @Ponynjaa, @ayZagen, @sserdyuk, @wydengyre, @mykola-mokhnach, @benkroeger, for your contributions.
All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
Element.getElementsByClassName
#722
Thank you, @censujiang, @Mathias-S, for your contributions
#713
isHTMLMimeType
in type definition #715
/ #712
#717
/ #285
/ #695
#710
Thank you, @krystofwoldrich, @marvinruder, @amacneil, @defunctzombie, @tjhorner, @danon, for your contributions
#637
/ #40
#634
/ #633
#692
#554
#550
#556
#697
#546
#524
#566
#644
#511
Thank you, @kboshold, @edi9999, @apupier, @shunkica, @homer0, @jhauga, @UdayKharatmol, for your contributions
#519
/ #45
/ #125
/ #467
BREAKING-CHANGE: Reports more not well-formed documents as fatalError
and drop broken support for optional and unclosed tags in HTML.Thank you, @brodybits, @cbettinger, @josecarlosrx, for your contributions
#513
Thank you, @qtow, @shunkica, @homer0, for your contributions
Thank you, @qtow, for your contributions
Thank you, @qtow, for your contributions
#509
/ #505
#498
/ #497
/ #117
\
BREAKING CHANGES: Many documents that were previously accepted by xmldom, esecially non well-formed ones are no longer accepted. Some issues that were formerly reported as errors are now a fatalError.#454
Thank you, @cjbarth, @shunkica, @pmahend1, @niklasl, for your contributions
Thank you, @cjbarth, for your contributions
Thank you, @cjbarth, for your contributions
BREAKING CHANGE: Previously it was possible (but not documented) to call Node.removeChild
with any node in the tree,
and with certain exceptions, it would work. This is no longer the case: calling Node.removeChild
with an argument that is not a direct child of the node that it is called from, will throw a NotFoundError DOMException, as it is described by the specs.
Thank you, @noseworthy, @davidmc24, for your contributions
compareDocumentPosition
method from level 3 spec. #488
getAttribute
and getAttributeNS
should return null
(#477) #46
#46
#485
/ #486
#489
BREAKING CHANGE: Iteration over attributes now happens in the right order and non-existing attributes now return null
instead of undefined. THe same is true for the namepsaceURI
and prefix
of Attr nodes.
All of the changes are fixing misalignment with the DOM specs, so if you expected it to work as specified,
nothing should break for you.
Thank you, @bulandent, @zorkow, for your contributions
#489
Thank you, @zorkow, for your contributions
#489
Thank you, @zorkow, for your contributions
Thank you, @bulandent, for your contributions
Thank you, @bulandent, for your contributions
Thank you, @edemaine, @pedro-l9, for your contributions
Thank you, @edemaine, @pedro-l9, for your contributions
Thank you, @edemaine, @pedro-l9, for your contributions
Thank you, @fengxinming, for your contributions
Thank you, @fengxinming, for your contributions
Thank you, @fengxinming, for your contributions
CVE-2022-39353
In case such a DOM would be created, the part that is not well-formed will be transformed into text nodes, in which xml specific characters like <
and >
are encoded accordingly.
In the upcoming version 0.9.0 those text nodes will no longer be added and an error will be thrown instead.
This change can break your code, if you relied on this behavior, e.g. multiple root elements in the past. We consider it more important to align with the specs that we want to be aligned with, considering the potential security issues that might derive from people not being aware of the difference in behavior.
Related Spec: https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validitylib
#448
/ #190
#447
/ #29
/ #130
Thank you, @XhmikosR, @awwright, @frumioj, @cjbarth, @markgollnick for your contributions
CVE-2022-39353
In case such a DOM would be created, the part that is not well-formed will be transformed into text nodes, in which xml specific characters like <
and >
are encoded accordingly.
In the upcoming version 0.9.0 those text nodes will no longer be added and an error will be thrown instead.
This change can break your code, if you relied on this behavior, e.g. multiple root elements in the past. We consider it more important to align with the specs that we want to be aligned with, considering the potential security issues that might derive from people not being aware of the difference in behavior.
Related Spec: https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validityThank you, @frumioj, @cjbarth, @markgollnick for your contributions
CVE-2022-39353
In case such a DOM would be created, the part that is not well-formed will be transformed into text nodes, in which xml specific characters like <
and >
are encoded accordingly.
In the upcoming version 0.9.0 those text nodes will no longer be added and an error will be thrown instead.
This change can break your code, if you relied on this behavior, e.g. multiple root elements in the past. We consider it more important to align with the specs that we want to be aligned with, considering the potential security issues that might derive from people not being aware of the difference in behavior.
Related Spec: https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validityThank you, @frumioj, @cjbarth, @markgollnick for your contributions
#445
/ #416
BREAKING CHANGE: It no longer reports an error when parsing HTML containing incomplete closing tags, to align the behavior with the one in the browser.
BREAKING CHANGE: If your code relied on not well-formed XML to be parsed and include subsequent tags, this will no longer work.#440
#444
Thank you, @ACN-kck, @mgerlach for your contributions
Thank you, @jftanner, @Supraja9726 for your contributions
Thank you, @Supraja9726 for your contributions
Thank you, @Supraja9726 for your contributions
Only use HTML rules if mimeType matches #338
, fixes #203
In the living specs for parsing XML and HTML, that this library is trying to implement, there is a distinction between the different types of documents being parsed: There are quite some rules that are different for parsing, constructing and serializing XML vs HTML documents.
So far xmldom was always "detecting" whether "the HTML rules should be applied" by looking at the current namespace. So from the first time an the HTML default namespace (http://www.w3.org/1999/xhtml
) was found, every node was treated as being part of an HTML document. This misconception is the root cause for quite some reported bugs.
BREAKING CHANGE: HTML rules are no longer applied just because of the namespace, but require the mimeType
argument passed to DOMParser.parseFromString(source, mimeType)
to match 'text/html'
. Doing so implies all rules for handling casing for tag and attribute names when parsing, creation of nodes and searching nodes.
BREAKING CHANGE: Correct the return type of DOMParser.parseFromString
to Document | undefined
. In case of parsing errors it was always possible that "the returned Document
" has not been created. In case you are using Typescript you now need to handle those cases.
BREAKING CHANGE: The instance property DOMParser.options
is no longer available, instead use the individual readonly
property per option (assign
, domHandler
, errorHandler
, normalizeLineEndings
, locator
, xmlns
). Those also provides the default value if the option was not passed. The 'locator' option is now just a boolean (default remains true
).
BREAKING CHANGE: The following methods no longer allow a (non spec compliant) boolean argument to toggle "HTML rules":
XMLSerializer.serializeToString
Node.toString
Document.toString
The following interfaces have been implemented:
DOMImplementation
now implements all methods defined in the DOM spec, but not all of the behavior is implemented (see docstring):
createDocument
creates an "XML Document" (prototype: Document
, property type
is 'xml'
)createHTMLDocument
creates an "HTML Document" (type/prototype: Document
, property type
is 'html'
).
false
no child nodes are createdDocument
now has two new readonly properties as specified in the DOM spec:
contentType
which is the mime-type that was used to create the documenttype
which is either the string literal 'xml'
or 'html'
MIME_TYPE
(/lib/conventions.js
):
hasDefaultHTMLNamespace
test if the provided string is one of the miem types that implies the default HTML namespace: text/html
or application/xhtml+xml
Thank you @weiwu-zhang for your contributions
nodeType
values to public interface description #396
#317
>
as specified #395
Object.assign
ponyfill #379
#378
Thank you @niklasl, @cburatto, @SheetJSDev, @pyrsmk for your contributions
#374
#365
#366
#358
, #376
#360
\n
before parsing takes place and will no longer be preserved.
#284
/ #310
\
BREAKING CHANGE: If you relied on the not spec compliant preservation of literal \t
, \n
or \r
in attribute values.
To preserve those you will have to create XML that instead contains the correct numerical (or hexadecimal) equivalent (e.g. 	
, 

, 
).DOMImplementation
and XMLSerializer
from lib/dom-parser.js
#53 / #309
BREAKING CHANGE: Use the one provided by the main package export.removeChild
#343
/ #355
#325
#111
/ #304
Thank you @marrus-sh, @victorandree, @mdierolf, @tsabbay, @fatihpense for your contributions
__prototype__
attributes #315
Thank you, @dsimpsonOMF#277
/ #301
#294
Thank you, @rrthomas#233
#302
#300
#297
#292
#279
Due to #271
this version was published as
xmldom
package to github (git tags 0.7.0
and 0.7.0+unscoped
)@xmldom/xmldom
package to npm (git tag 0.7.0+scoped
)
For more details look at #278
CVE-2021-32796
Document.getElementsByClassName
as specified #213
, thank you, @ChALkeR#268
#267
DOMImplementation
according to recent specs #210
#244
#168
released in 0.6.0)localName
as part of Document.createElement
#229
, thank you, @rrthomasxmlns:ds=""
#168
<
to <
when serializing attribute values #198
/ #199
Avoid misinterpretation of malicious XML input - GHSA-h6q6-9hqw-rwfv
(CVE-2021-21366)
DOMParser.errorHandler
before parsing, to handle those errors differently.To accomplish this and also be able to verify it in tests I needed to
Error
type ParseError
and export itParseError
from errorHandler.fatalError
and prevent those from being caught in XMLReader
.DOMHandler
constructor as __DOMHandler
publicId
and systemId
as is, including any quotes.
BREAKING CHANGE: If somebody relies on the actual unquoted values of those ids, they will need to take care of either single or double quotes and the right escaping.
(Without this change this would not have been possible because the SAX parser already dropped the information about the quotes that have been used in the source.)https://www.w3.org/TR/2006/REC-xml11-20060816/#dtd https://www.w3.org/TR/2006/REC-xml11-20060816/#IDAX1KS (External Entity Declaration)
Fix breaking preprocessors' directives when parsing attributes #171
fix(dom): Escape ]]>
when serializing CharData #181
Switch to (only) MIT license (drop problematic LGPL license option) #178
Export DOMException; remove custom assertions; etc. #174
readme.md
#188
behavior from v0.1.27 #67
#113
#156
#144
#91
#84
#66
#63
#78
#104
#79
#81
#70
#77
#64
#106
#107
vows
tests, drop proof
tests #59
#114
xmltest
cases #112
#108
#86
component.json
(deprecated package manager https://github.com/componentjs/guide)lib
subdirectory.files
entry in package.json
and remove use of .npmignore
.Document.getElementsByClassName
.Node
to the list of exportsentityMap
.homepage
, repository
and bugs
URLs in package.json
.xmldom-alpha@v0.1.28
by the original authors.Object.create
check from the _extends
method of dom.js
that added a __proto__
property ().__proto__
propertypackage.json
The patch versions (v0.1.29
- v0.1.31
) that have been released on the v0.1.x branch, to reflect the changed maintainers, are branched off from v0.1.27
so they don't include the breaking changes introduced in xmldom-alpha@v0.1.28
:
After the last commit to the original repository https://github.com/jindw/xmldom on the 9th of May 2017, the first commit to https://github.com/xmldom/xmldom is from the 19th of December 2019. The fork has been announced in the original repository on the 2nd of March 2020.
The versions listed below have been published to one or both of the following packages:
It is currently not planned to continue publishing the xmldom-alpha
package.
The new maintainers did not invest time to understand changes that led to the last xmldom
version 0.1.27
published by the original maintainer, but consider it the basis for their work.
A timeline of all the changes that happened from that version until 0.3.0
is available in https://github.com/xmldom/xmldom/issues/62. Any related questions should be asked there.
Published by @jindw on the 9th of May 2017 as
xmldom-alpha@0.1.28
BREAKING includes regression regarding
(issue #57)
Fix dom.js
serialization issue for missing document element (example that failed on toString()
before this change)
Add new module entities.js
Published by @jindw on the 28th of Nov 2016 as
xmldom@0.1.27
xmldom-alpha@0.1.27
Various bug fixes.
Published on the 18th of Nov 2016
as xmldom@0.1.26
Published on the 18th of Nov 2016 as
xmldom@0.1.25
Details unknown
Published on the 27th of November 2016 as
xmldom@0.1.24
xmldom-alpha@0.1.24
Added node filter.
Published on the 5th of May 2016 as
xmldom-alpha@0.1.23
Add namespace support for nest node serialize.
Various other bug fixes.
*
NS support for getElementsByTagNameNS.ns
support.Details missing for this and potential earlier version
component.json
#52.