Issue 1522 - Use classList attribute instead dealing with className

--HG--
extra : rebase_source : e71b67f771d4ab1542f39c810da925aceb3f1b65
Issue 1527 - Properly escape generated CSS selectors

--HG--
extra : rebase_source : 736d78abdcc4d6ead18a0c8676a68cd187d8e7e3