Describe the bug
When providing options to the DOMParser constructor and leaving out the locator option this option will not be set to true even though the typedef says it is true by default.
It is only being set to true here when the options are omitted completely.
To Reproduce
import * as xmldom from '@xmldom/xmldom';
const parser = new xmldom.DOMParser({
onError: (level, message) => {
console.log({level, message});
}
});
try {
const doc = parser.parseFromString(`<?xml version="1.0" encoding="utf-8"?>
<content>
<chapter>
</content>
`, 'text/xml');
} catch (error) {
console.log(error.locator); // -> undefined
}
Expected behavior
In the example above error.locator should be { lineNumber: 3, columnNumber: 13 }.
Runtime & Version:
xmldom version: 0.9.2
runtime version: Node 20
Describe the bug
When providing options to the
DOMParserconstructor and leaving out thelocatoroption this option will not be set to true even though the typedef says it is true by default.It is only being set to true here when the options are omitted completely.
To Reproduce
Expected behavior
In the example above
error.locatorshould be{ lineNumber: 3, columnNumber: 13 }.Runtime & Version:
xmldom version: 0.9.2
runtime version: Node 20