You need "long tangent" elbows or pipe pup pieces if you're going to insert them into slip-on flanges.
Is inserting a normal butt-welding fitting into a slip-on flange directly and welding it a code violation? I don't know, but I do know that it is certainly BAD PRACTICE for code piping and you should not do it. A glance at the resulting exterior fillet weld geometry should tell you why in an instant. On a short radius elbow, you also may not be able to achieve the insertion depth required for the ID weld to take place in the correct location. I don't recall what the weld dimensional tolerances are for slip ons in B16.5, but simple physics should tell you that the ID weld must be close enough to the flange face such that no part of that ID fillet weld is on the HUB of the slip on flange- that weld must occur somewhere in the thickness of the flange itself. Slip-on flanges attached by 1 rather than 2 fillets are also prohibited in normal fluid service by B31.3 if I recall correctly: both the ID and OD weld are required.