What you Need
What to do
What may happen
Rather surprisingly you should find that the water stays in the glass even though you wouldn't think the handkerchief was very waterproof.
Why does it happen?
The first thing to work out is how water falls out of a glass normally. For the water to fall out something has to take its place, normally air. But how does the air choose where to get into the glass.
If the base of the water is uneven, a lower part will have more weight of water above it than a higher part. This means it will start to fall down sucking water away from other areas, and that the air can get into the higher areas, allowing the water to fall out.
This can happen because there is nothing stopping the slight unevenness in the base of the water growing.
If you look at a hanky it has lots of fine pieces of cotton thread woven into a fabric. In between them there are small holes where normally air or water can get through. Cotton really likes water so once the hanky is wet it is covered with water. Now if air wants to get through the holes it has to push the water out of the way - it has to blow little bubbles.
If you have ever tried blowing bubbles and then stopped halfway through you will know that the film will try and pull itself flat due to the surface tension. The same happens here, but the smaller the bubble the harder they will pull back, and there is no soap in the water which reduces the surface tension.
This means that the air has to push really quite hard to get through the fabric, much harder than it could do randomly. So the imperfections can't build up and the water stays inside.
The hanky isn't watertight, but it is airtight, which is enough to keep the water in.
If you put the glass on its side or make the hanky very loose there is enough pressure difference to blow the bubbles, letting air in so it will leak.
What has this got to do with breathable fabrics?
In a breathable coat (made of something like Gore-Tex) you want to stop rain coming in but still let sweat evaporate from your skin. This is the opposite requirement from the hanky which lets liquid through but not gasses. The problem is actually solved in a really similar way.
Instead of making the fabric out of something like cotton which loves water, you make it out of something which hates it (like PTFE - the non-stick frying pan stuff). Now for a water drop to go through it has to split up into lots of tiny drops, which surface tension will fight very strongly just like making small bubbles, but water vapour from your sweat can pass straight through. Just what you wanted.