I don’t think spacing between HTML attributes is required. (Haven’t checked the spec, but at least freeCodeCamp and CodePen (FireFox) don’t mind if there’s no spacing.)
I tested the corrected version of OP’s answer in freeCodeCamp without changing spacing, and an arbitrary div in CodePen. Both worked perfectly fine.