The way i ve been taught Leibniz's notation is by the definition of the differential of a function.
The differential df of a function f, is the function ##df(\tau,x)=f'(x)\tau## where ##\tau## is a variable independent of the variable x. However where things "go messy" with the notation is on the next step:
Consider the differential di of the identity function i(x)=x. It will be ##di(\tau,x)=i'(x)\tau=\tau## so if we allow the notation ##di(\tau,x)=dx(\tau,x)## (because i(x)=x) we end up with ##dx(\tau,x)=\tau## or abbreviated ##dx=\tau##. It is important to notice that ##dx## simply stands for the differential of the identity function.
So going back to ##df(\tau,x)=f'(x)\tau## and using the fact that ##dx=\tau## we end up with ##df(\tau,x)=f'(x)dx(\tau,x)## or in compact notation ##df=f'dx##. Dont forget that on this last equation on the RHS we have an ordinary multiplication of two functions (the function f' and the function dx) so we can write it as ##\frac{df}{dx}=f'##.
Just to clear a thing, dx is independent of x, it is essentially the independent variable ##\tau##.