-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: var allPeriods = /\./g; Then in the injection, it's as simple as replacing it: 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.
- Loading branch information
Showing
5 changed files
with
19 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters