Fix Warning: Illegal string offset 'class' ...

This PR fix:
Warning: Illegal string offset 'class' in ../libraries/cms/html/html.php on line 965
Warning: Illegal string offset 'class' in .../libraries/cms/html/html.php on line 966

+ a bit code style and prevert issues like we have for the calender field.

Please see here:
http://www.joomla-bugs.de/forum/index.php?topic=585.msg2881#new
and here:
http://www.joomlaeventmanager.net/forum/testing-on-joomla-3-x/8391-solved-j3-problem-opening-search-menu#13539