This involves a "bridging" situation. You can certain have the new employer file the transfer and extension petition, but if for some reason the extension with your current employer is denied, the bridge collapses and your extension request with the new employer could be denied. The petition could still be approved, but you would have to travel to the U.S. consulate in your home country to get a new H-1B visa.
You may want to consider converting your current extension petition to premium processing so you get a quicker decision, and then can safely change employers.
All the best,
The answer above is correct, however, if the currently pending H-1B visa petition is denied, it might put you out of status which could cause the USCIS to deny the extension on the new H-1B, which would necessitate your departure from the USA to obtain a new H-1B visa stamp in your passport prior to your return.