React Calculator not working on Safari

Hi there. Could someone help me with my React Calculator? It isn’t working on Safari.

I’ve finished and submitted the project, passing all the tests. It works perfectly on Chrome, looks great on Safari and even works sometimes on Safari.

When I click a button, my click handler event.target will sometimes return the string with the final quotation mark on the next line. This is effecting the function.

My codepen is https://codepen.io/doulosiyxy/pen/eYMYNxG?editors=0110

EDIT: OK, so after some exploring, I found that Safari was adding space around the event.target value on clicks. So I added trim() to the value before running it through my abstract factory.

Many thanks

That is odd, just out of curiosity does it also contain spaces when using textContent instead of innerText?

Hi, thanks. I just tested this, and textContent eliminates the problem too.

Thanks.

Interesting, thank you for testing it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.