The default browser behavior when setting .textContent to null or undefined is to ultimately set the content to ''†. This is quite different from the behavior of createTextNode though… by splitting the text node creation into multiple steps we can consistently leverage .textContent and remove the need to ?? ''.
† Note that the WHATWG spec only defines that behavior for null, but
in practice all modern browsers seem to treat undefined similarly.
Here’s the spec for reference. This is related to #204.
The default browser behavior when setting
.textContent
tonull
orundefined
is to ultimately set the content to''
†. This is quite different from the behavior ofcreateTextNode
though… by splitting the text node creation into multiple steps we can consistently leverage.textContent
and remove the need to?? ''
.† Note that the WHATWG spec only defines that behavior for
null
, but in practice all modern browsers seem to treatundefined
similarly.Here’s the spec for reference. This is related to #204.