Fix bug in btngroup anchoring when anchor doesn't exist

Change-Id: Id89aa31edf6d9ee06046b22f6f4cefa34366f46e
diff --git a/dev/js/spec/buttongroupSpec.js b/dev/js/spec/buttongroupSpec.js
index 258d847..07183f2 100644
--- a/dev/js/spec/buttongroupSpec.js
+++ b/dev/js/spec/buttongroupSpec.js
@@ -256,8 +256,11 @@
       const c1 = el.appendChild(document.createElement('c1'));
       const c2 = el.appendChild(document.createElement('c2'));
       const c3 = el.appendChild(document.createElement('c3'));
+
+      let group = buttonGroupClass.adopt(el);
+      expect(group.anchor(null)).toBeFalsy();
       
-      const group = buttonGroupClass.adopt(el);
+      group = buttonGroupClass.adopt(el);
       expect(group.anchor(c3)).toBeTruthy();
 
       group.add('Meta', {'cls':['meta', 'top']}, function (e) {});
diff --git a/dev/js/src/buttongroup.js b/dev/js/src/buttongroup.js
index 721fdcb..dabe710 100644
--- a/dev/js/src/buttongroup.js
+++ b/dev/js/src/buttongroup.js
@@ -57,7 +57,7 @@
      * Define element following newly added buttons.
      */
     anchor : function (anchor) {
-      if (anchor.parentNode == this._el) {
+      if (anchor !== null && anchor.parentNode == this._el) {
         this._anchor = anchor;
         return true;
       };