2.1.54 [HTML5:2014] Section 4.9.1 The table element

V0132: The insertRow function incorrectly inserts new rows

The specification states:

 4.9.1 The table element
     ...
     The behavior of the insertRow(index) method depends on the state of the table. When 
     it is called, the method must act as required by the first item in the following list 
     of conditions that describes the state of the table and the index argument:
  
         If index is less than −1 or greater than the number of elements in rows 
         collection:
  
             The method must throw an IndexSizeError exception.
  
         If the rows collection has zero elements in it, and the table has no tbody 
         elements in it:
  
             The method must create a tbody element, then create a tr element, then append 
             the tr element to the tbody element, then append the tbody element to the 
             table element, and finally return the tr element.
  
         If the rows collection has zero elements in it:
  
             The method must create a tr element, append it to the last tbody element in 
             the table, and return the tr element.
  
         If index is −1 or equal to the number of items in rows collection:
  
             The method must create a tr element, and append it to the parent of the last 
             tr element in the rows collection. Then, the newly created tr element must be 
             returned.
  
         Otherwise:
  
             The method must create a tr element, insert it immediately before the indexth 
             tr element in the rows collection, in the same parent, and finally must 
             return the newly created tr element.

IE11 Mode, IE10 Mode, IE8 Mode, IE7 Mode, and IE5 (Quirks) Mode (All versions)

The insertRow function incorrectly inserts new rows:

      ▪ When the <table> is empty, a <tbody> will be created.

      ▪ When the <table> contains only a <thead>, insertRow will add a new <tr> to the <thead> - a <tbody> is not added.

      ▪ When the <table> contains a <tfoot>, insertRow will add a new <tr> to the <tfoot> - a <tbody> is not added.