This commit also adds support for `class` and `name` attributes to directives in general. Closes #4715.