2 ms·
the user could accidentally buy what they did not intend to This is absolutely the wrong way to write front end code. What the browser renders should only eve
by onion2k 11y ago
the user could accidentally buy what they did not intend to
This is absolutely the wrong way to write front end code.
What the browser renders should only ever be a representation of the state of an internal model (eg the basket in this case). You should update the state of that model and then render what it's changed to if that change is successful. In the case of an eCommerce app that change should involve a round trip to the server to update the session. Querying the HTML to find out the state is bad enough (it's slow) but relying on a CSS animation to complete in order to remove something from a user's cart is just about the most stupid thing I've seen in 20 years of web development.