refs #4996 more tests and bugfixes, improved API, some work on crossbrowser support