Ensure correct attribute handling for nested elements