SitePen/dgrid — pull request #402 by brianarn (2013-01-25 05:08:42+00:00)
Title: Adjusting CSS rule insertion to escape periods in IDs

It turns out, periods in IDs have been valid in HTML since 4.01 (at least):
http://www.w3.org/TR/html401/types.html#h-6.2

In the event that a user creates a dgrid with a period in its ID, such
as "foo.bar", the injected CSS rule creates a selector of "#foo.bar",
which winds up parsing as an element with ID of "foo" and a class of
"bar".

Fortunately, CSS2 allows for backslashes:
http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier

As such, this pull request includes modification to four primary areas
where the grid DOM node ID is being used for rule creation. I create a
simple regex:

```javascript
var allPeriods = /\./g;
```

Then in the injection, it's as simple as replacing it:

```javascript
someSelector = "#" + this.domNode.id.replace(allPeriods, "\\.") + whatever;
```

I've tested these changes and they do not seem to impact any of the
related tests in any negative ways. I've also augmented the
ColumnResizer tests to include a grid with a period in its ID, as that's
the most readily apparent example of this bug that I'd ran into.

Tests performed in the following:

* Chrome 24, OS X
* Firefox 18, OS X
* IE8, Windows 7

The resizing works in all of them.