Support for hierarchical and attribute css selectors.

This commit is contained in:
Nedyalko Nikolov
2016-02-12 11:26:50 +02:00
parent c0682fce80
commit 6e4d6ccfbc
6 changed files with 924 additions and 89 deletions

View File

@@ -29,6 +29,11 @@ export function parseJSON(source: string): any {
return JSON.parse(src);
}
export function escapeRegexSymbols(source: string): string {
let escapeRegex = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
return source.replace(escapeRegex, "\\$&");
}
export module layout {
var MODE_SHIFT = 30;

6
utils/utils.d.ts vendored
View File

@@ -229,4 +229,10 @@
* @param url The url.
*/
export function openUrl(url: string): boolean
/**
* Escapes special regex symbols (., *, ^, $ and so on) in string in order to create a valid regex from it.
* @param source The original value.
*/
export function escapeRegexSymbols(source: string): string
}