detect-zero-width-characters-chrome-extension
detect-zero-width-characters-chrome-extension copied to clipboard
wip: add option delay to check pages
PoC
Before
After
@roymckenzie, we could try to set another option as described here #2 :thinking:
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?
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:
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.