Skip to content

Commit

Permalink
* Node.prototype.transform - simplified logic for empty transformatio…
Browse files Browse the repository at this point in the history
…n documents
  • Loading branch information
uriel-online committed May 14, 2024
1 parent b665e10 commit a6c2c7f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions xo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7467,15 +7467,9 @@ xover.modernize = async function (targetWindow) {
Object.defineProperty(Node.prototype, 'transform', {
value: function (xml_document) {
let self = this;
if (xml_document instanceof Document && !xml_document.firstChild && xml_document.source) {
return new Promise(async (resolve, reject) => {
try {
let result = self.transform(await xml_document.source.fetch().catch(e => Promise.reject(e)))
return resolve(result);
} catch (e) {
return reject(e)
}
})
if (xml_document instanceof Document && !xml_document.childNodes.length) {
let ready = xml_document.ready;
return ready.then(() => self.transform(xml_document));
}
if (xml_document instanceof Promise) {
return xml_document.then((document) => self.transform(document));
Expand Down

0 comments on commit a6c2c7f

Please sign in to comment.