I've found on StackOverflow an old answer written by me, in which I've used the first form.
Reading it now, it sounds weird and wrong;
I am inclined to think that the second form is the only one correct,
but googling "preventing it to" and "preventing it from" there are 300.000+ results for the first and 700.000+ results for the second!
The 300k+ results for the first form seem way too much for a completely wrong form, hence I've decided to ask here.
EDIT: The original sentence is:
Add
white-space: nowrap;to your.layoutstyle declaration.This will do exactly what you need, preventing divs to wrap.
NPtoVPis ungrammatical. Prevent takes a gerund complement following from; it doesn't take an infinitive complement. – John Lawler Jun 04 '15 at 14:41preventspecifically. – Tushar Raj Jun 04 '15 at 14:44