Board Thread:General Discussion/@comment-6003396-20130419113251/@comment-667748-20130510095353

Well, what you are doing seems to work. As I said, as long as the user uses it correctly, it should work. Your "switch" clauses are kind of wrong though;

As you can see, your case 1 and 2 are the strings "" (empty) and "0". Checking for the string "0" makes little sense to me, because, well, why would you give it special treatment? What if the user actually wants a width of 0? It is a common scheme that means "as small as possible".

You'd want it to simply look like this:

There is one more neat trick: The "empty string" vs "no supplied string" For example:

style="width:;"

Using this scheme, the user has the choice of "default", "specify", or simply "squash": undefined            => style="width:100%;" undefined => style="width:80%;" undefined   => style="width:"

See? Nifty.