detect-zero-width-characters-chrome-extension icon indicating copy to clipboard operation
detect-zero-width-characters-chrome-extension copied to clipboard

wip: add option delay to check pages

Open kip-13 opened this issue 1 year ago • 4 comments

PoC

image

Before image

After image

kip-13 avatar Oct 31 '23 12:10 kip-13

@roymckenzie, we could try to set another option as described here #2 :thinking:

kip-13 avatar Oct 31 '23 13:10 kip-13

I saw your comments on the pull request you reviewed (thank you!), but am still not clear on why this error is being thrown. Is the DOM not fully loaded? Is setting an arbitrary delay going to cover edge cases?

roymckenzie avatar Oct 31 '23 15:10 roymckenzie

The issue is we manipulate the DOM and when we use innerHTML the original nodes are kind of recreated and all the elements touched lose the original events or attrs created from any js code or framework, in this case for medium is react.

This possible solution is to set an arbitrary delay and with that wait for a time when all the js manipulation are done.

But I think perhaps we should change the innerHTML manipulation to something less intrusive :thinking:

kip-13 avatar Oct 31 '23 15:10 kip-13

Ah! I see. That makes sense. I dug around a bit. I tried to see if there was any way to set style rules based on the type of character. No dice.

I am open to seeing a different solution other than innerHTML to inject a span. Barring a new solution to injecting the span, I think a time delay is an acceptable solution.

I do not think it is necessary to allow the extension user to set the time. I think hardcoding a time delay is sufficient (wrapping the checkPage call in a setTimeout of 1000 milliseconds).

This will likely cover most edge cases until a cleaner solution can be found.

roymckenzie avatar Oct 31 '23 19:10 roymckenzie