diff --git a/src/libs/SelectionScraper/index.js b/src/libs/SelectionScraper/index.js index b3562b7ee84d..363367072631 100644 --- a/src/libs/SelectionScraper/index.js +++ b/src/libs/SelectionScraper/index.js @@ -88,10 +88,11 @@ const replaceNodes = (dom) => { let domName = dom.name; let domChildren; const domAttribs = {}; + let data; // Encoding HTML chars '< >' in the text, because any HTML will be removed in stripHTML method. if (dom.type === 'text') { - dom.setAttribute('data', Str.htmlEncode(dom.data)); + data = Str.htmlEncode(dom.data); } // We are skipping elements which has html and body in data-testid, since ExpensiMark can't parse it. Also this data @@ -118,6 +119,7 @@ const replaceNodes = (dom) => { return { ...dom, + data, name: domName, attribs: domAttribs, children: domChildren,