title: Error : Cannot read property 'cloneNode' of undefined
body: <p>I'm trying to add a listener to my Database using Firebase.</p>
  
  <pre><code>const dbRef=firebase.database().ref().child('messages');
  dbRef.on('child_added', MS.bringData);
  </code></pre>
  
  <p>When something is added, I execute <code>bringData</code> which creates a new object called <code>message</code> from the <code>snap</code> object.</p>
  
  <pre><code>export const bringData = (snap) =&gt; {
    const message1=new Message(snap.val().objet, snap.val().message, snap.val().etat, snap.val().key);
    message1.creerLigne();
  }
  </code></pre>
  
  <p>Then I call <code>creerLigne()</code> from the class <code>Message</code>, to create the new line and add it to <code>tbody</code></p>
  
  <pre><code>creerLigne() {
       const arg=[this._objet, this._message, this._etat, this._id];
       const row=document.createElement("tr");
       row.setAttribute('id', this._id);
       const data=document.createElement("td");
       var checkB=document.createElement("input").setAttribute('type', 'checkbox', 'name', 'delete');
  
       var i=0;
       while(i&lt;arg.length-1) {
           let data1=data.cloneNode();
           let text=document.createTextNode(arg[i]);
           data1.appendChild(text);
           row.appendChild(data1);
           i++;
       }
  
       data1.appendChild(text);
       row.appendChild(data1);
       row.appendChild(checkB.cloneNode());
       document.body.appendChild('row');
  }
  </code></pre>
  
  <p>but unfortunately I'm getting the following error:</p>
  
  <pre><code>FIREBASE WARNING: Exception was thrown by user callback. TypeError: Cannot read property 'cloneNode' of undefined
      at Message.creerLigne 
  </code></pre>