separate 'for' attribute logic into 'targetElement'