This is a real D-flip flop, unlike others on the website. Those are actually D-latch devices.
The big difference between D-latch and D-flip flop is that flip flops only change the output at the edge of a signal. For example when a clock signal goes high.
To achieve the edge triggering behavior I added three inverters and a XOR gate. Each inverter causes an delay of the original signal. The XOR gate compares the signal of the two and when the two signals are not the same it becomes true. Since the signal is delayed for only a small amount of time, the XOR gate will only give a small pulse at which the D-latch can change its output