From 6580f536077c0bbfa738446f513c0225143909b9 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 24 Sep 2015 11:00:51 -0500 Subject: [PATCH] fix(button): ignore comment nodes --- ionic/components/button/button.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ionic/components/button/button.ts b/ionic/components/button/button.ts index 7d7269069d..b6f5d038e5 100644 --- a/ionic/components/button/button.ts +++ b/ionic/components/button/button.ts @@ -28,20 +28,22 @@ export class Button { let nodes = []; for (let i = 0, l = childNodes.length; i < l; i++) { childNode = childNodes[i]; + if (childNode.nodeType === 3) { // text node if (childNode.textContent.trim() !== '') { nodes.push(TEXT); } - } else if (childNode.nodeName === 'ICON') { - // element node - nodes.push(ICON); - - } else { - // element other than an - nodes.push(TEXT); + } else if (childNode.nodeType === 1) { + if (childNode.nodeName === 'ICON') { + // icon element node + nodes.push(ICON); + } else { + // element other than an + nodes.push(TEXT); + } } }