Respect allowed attributes

Reported by Chris Hough, although using a different approach to fix the
issue as it was just a little oversight.