fabiospampinato / cash

An absurdly small jQuery alternative for modern browsers.
MIT License
6.51k stars 266 forks source link

Ensure empty text fragments are not created from white-spaces #387

Closed r-aamir closed 2 years ago

r-aamir commented 2 years ago

For comparing jQuery behaviour, please check https://codepen.io/r-aamir/pen/yLzbgKr

fabiospampinato commented 2 years ago

Wait actually I've reverted the commit.

We have a test explicitly against this: https://github.com/fabiospampinato/cash/blob/736f09a1c6da4696313521ca2d221f7459001354/test/modules/utilities.js#L279

I don't remember the reason for this, but I'm going to trust past myself that there was a good reason for it.


jQuery does indeed preserve the whitespace when executing something like $.parseHTML ( ' <b>foo</b>' ), so the fix should be somewhere else.