Hi Woxxom,
I tried what you told me.
When I pass the node from inside world(page script) to outside world (content script) using MouseEvent(), the extra angular DOM attributes are indeed stripped. This is exactly what I wanted.
Now, our application is designed to be used both as a browser extension OR as an SDK. :
https://github.com/Digital-Assistant/Digital_Assistant_Client#integrate-as-sdk-into-applicationsWhile your suggestion works for Browser Extension (transferring node from inside world to inside world), it is not working as intended in the SDK (inside world to inside world).
i.e the elements are not stripped when I pass the node element to another method in the inside world itself.
I am attaching click event like this to clickable elements
node.addEventListener('click', async function (event: any) {
await recordUserClick(node, event);
}, {once: false});
Under recordUserClick i am sending the dom node for removing 'dom expandos' like below
document.dispatchEvent(new MouseEvent('UDANodeData', {relatedTarget: node}));
under content script i was getting the node object as given below
document.addEventListener("UDANodeData", function(data) {
console.log('nodedata listener at content script');
console.log({node: data.relatedTarget});
});
under page script i am doing it as given below
document.addEventListener("UDANodeData", function(data: any) {
console.log('nodedata listener at page script');
console.log({node: data.relatedTarget});
});
Please let me know how we can achieve the outside world under the same page script.
Do you have any suggestions to make it work for SDK too