just curios: in other places of the codebase we use `element.type` and `element.name` instead of `$(..).attr()`.

seems to be safe and consistent to also use it here? .. in another PR of course