Bttstrp / bootstrap-switch

Turn checkboxes and radio buttons in toggle switches.
MIT License
5.08k stars 1.45k forks source link

Thousands of bootstrap-switch: Forced reflow is a likely performance bottleneck. #718

Open leoplct opened 4 years ago

leoplct commented 4 years ago

I have thousands of bootstrap-switch as table row, like code below. It's very expensive too load and if I see on ChromeDevTool (performance) I can see: Warning Forced reflow is a likely performance bottleneck.

How can I make it faster? The time spent for rendering is too much and it breaks the page.

$("input[data-toggle='toggle']").bootstrapSwitch({
        onSwitchChange:function(event, state) {
            $(this).parents('form').trigger('change')
        }
    });

Table with +1.000 rows

<table>
<thead>...</thead>
<tbody>
  <tr>
     <td>
           <form action="...:">
               <input type="checkbox" data-toggle="toogle"/>
             </form>
   </td>
  </tr> 
</table>