wrapQuotesIfNecessary

Quote a CSS string (unless it is already quoted).

CSS text content should always be surrounded by quotes, but this is a pretty subtle requirement that's easy to miss and causes silent failures.

This method will investigate a string that is intended to be used as CSS text content and wrap it with quotes (unless it is already properly wrapped).

For example:

  • test ->"test"

  • "test" ->"test" (unchanged)

  • "Is the test today?" he asked ->"\"Is the test today?\" he asked"