Use setAttribute("class") instead of className.

Fixes #1112.