| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -198,6 +198,29 @@ export function test_class_selector() { | |||
| 198 | 198 | TKUnit.assert(btnWithNoClass.style.color === undefined, "Color should not have a value"); | |
| 199 | 199 | } | |
| 200 | 200 | ||
| 201 | + export function test_class_selector_with_escape_characters() { | ||
| 202 | + let page = helper.getClearCurrentPage(); | ||
| 203 | + let btnWithClass1: buttonModule.Button; | ||
| 204 | + let btnWithClass2: buttonModule.Button; | ||
| 205 | + | ||
| 206 | + page.css = ".test-1 { color: red; } .test-1\\/2 { color: blue }"; | ||
| 207 | + | ||
| 208 | + //// Will be styled | ||
| 209 | + btnWithClass1 = new buttonModule.Button(); | ||
| 210 | + btnWithClass1.className = "test-1"; | ||
| 211 | + | ||
| 212 | + btnWithClass2 = new buttonModule.Button(); | ||
| 213 | + btnWithClass2.className = "test-1/2"; | ||
| 214 | + | ||
| 215 | + const stack = new stackModule.StackLayout(); | ||
| 216 | + page.content = stack; | ||
| 217 | + stack.addChild(btnWithClass1); | ||
| 218 | + stack.addChild(btnWithClass2); | ||
| 219 | + | ||
| 220 | + helper.assertViewColor(btnWithClass1, "#FF0000"); | ||
| 221 | + helper.assertViewColor(btnWithClass2, "#0000FF"); | ||
| 222 | + } | ||
| 223 | + | ||
| 201 | 224 | export function test_multiple_class_selector() { | |
| 202 | 225 | let page = helper.getClearCurrentPage(); | |
| 203 | 226 | let btnWithClasses: buttonModule.Button; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -546,7 +546,7 @@ function parseArgumentsList<T>(text: string, start: number, argument: (value: st | |||
| 546 | 546 | } | |
| 547 | 547 | end = arg.end; | |
| 548 | 548 | value.push(arg); | |
| 549 | - | ||
| 549 | + | ||
| 550 | 550 | closingBracketOrCommaRegEx.lastIndex = end; | |
| 551 | 551 | const closingBracketOrComma = closingBracketOrCommaRegEx.exec(text); | |
| 552 | 552 | if (closingBracketOrComma) { | |
@@ -734,7 +734,7 @@ export function parseUniversalSelector(text: string, start: number = 0): Parsed< | |||
| 734 | 734 | return { start, end, value: { type: "*" }}; | |
| 735 | 735 | } | |
| 736 | 736 | ||
| 737 | - const simpleIdentifierSelectorRegEx = /(#|\.|:|\b)([_-\w][_-\w\d]*)/gy; | ||
| 737 | + const simpleIdentifierSelectorRegEx = /(#|\.|:|\b)([_-\w][_-\w\d\\/]*)/gy; | ||
| 738 | 738 | export function parseSimpleIdentifierSelector(text: string, start: number = 0): Parsed<TypeSelector | ClassSelector | IdSelector | PseudoClassSelector> { | |
| 739 | 739 | simpleIdentifierSelectorRegEx.lastIndex = start; | |
| 740 | 740 | const result = simpleIdentifierSelectorRegEx.exec(text); | |
@@ -743,7 +743,7 @@ export function parseSimpleIdentifierSelector(text: string, start: number = 0): | |||
| 743 | 743 | } | |
| 744 | 744 | const end = simpleIdentifierSelectorRegEx.lastIndex; | |
| 745 | 745 | const type = <"#" | "." | ":" | "">result[1]; | |
| 746 | - const identifier: string = result[2]; | ||
| 746 | + const identifier: string = result[2].replace(/\\/g, ""); | ||
| 747 | 747 | const value = <TypeSelector | ClassSelector | IdSelector | PseudoClassSelector>{ type, identifier }; | |
| 748 | 748 | ||
| 749 | 749 | return { start, end, value }; | |
@@ -1617,4 +1617,4 @@ export class CSSNativeScript { | |||
| 1617 | 1617 | ||
| 1618 | 1618 | return selectors; | |
| 1619 | 1619 | } | |
| 1620 | - } | ||
| 1620 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments