I think you meant to say, "Why can they just divide trigonometric functions by x? Won't that mess up/change the original expression?"
They are doing what we always do with fractions: multiply or divide both numerator and denominator by the same thing, which doesn't change its value. Dividing both by x is no different from multiplying both by x (as long as x is not zero -- and it isn't while you take the limit). To put it differently, they are multiplying by (1/x)/(1/x), which is 1.