The empty `if` block here is weird. I would prefer:

```ruby
type_attr  = node['type'] || node.attributes['type'].value
```