#103 textContent get issue

This commit is contained in:
Agriya Dev5
2021-05-22 18:37:38 +05:30
parent 203af05cd5
commit 7a3c2a0b58
3 changed files with 6 additions and 4 deletions

View File

@@ -722,7 +722,7 @@ export const getTextMethod = function () {
const selectedElements = elemContext_.getSelectedElements();
const selected = selectedElements[0];
if (isNullish(selected)) { return ''; }
return selected.textContent;
return (selected) ? selected.textContent : '';
};
/**

View File

@@ -294,7 +294,7 @@ export class ChangeElementCommand extends Command {
this.oldValues = attrs;
for (const attr in attrs) {
if (attr === '#text') {
this.newValues[attr] = elem.textContent;
this.newValues[attr] = (elem) ? elem.textContent : '';
} else if (attr === '#href') {
this.newValues[attr] = getHref(elem);
} else {