Derivation of the equations used in this simulator is given in
this note.
For comparison,
another simulator based on the physical engine "CANNON.js" is
presented
here.
In this simulator, "HingeConstraint" option provided by CANNON.js is used
for the constraints at the rotating shafts.
However, the constraint forces at the shafts become so large
that the simulator cannot follow the constraints well enough, which
results in the energy dissipation.
Actually, something similar is happening in the case of a real
double pendulum also;
When the large constraint forces act on the shafts,
the swing motion of the pendulum rocks the bench on which the
pendulum is fixed. This seems to be the major source of its
energy dissipation.
The simulator in this site, does not have such dissipation because
the constraints are embedded in the eqation of motion by reducing
the number of variables, as is explained in the above note.