Skip to content

Commit c9e331b

Browse files
authored
Merge pull request preactjs#696 from bmeurer/Typeof_Equals_Boolean
Use typeof to test booleaness.
2 parents 9001436 + 3f38738 commit c9e331b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/h.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function h(nodeName, attributes) {
2525
for (i=child.length; i--; ) stack.push(child[i]);
2626
}
2727
else {
28-
if (child===true || child===false) child = null;
28+
if (typeof child==='boolean') child = null;
2929

3030
if ((simple = typeof nodeName!=='function')) {
3131
if (child==null) child = '';

src/vdom/diff.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function idiff(dom, vnode, context, mountAll, componentRoot) {
6666
prevSvgMode = isSvgMode;
6767

6868
// empty values (null, undefined, booleans) render as empty Text nodes
69-
if (vnode==null || vnode===false || vnode===true) vnode = '';
69+
if (vnode==null || typeof vnode==='boolean') vnode = '';
7070

7171

7272
// Fast case: Strings & Numbers create/update Text nodes.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy