@@ -2647,6 +2647,57 @@ public void dimensionQ() throws Exception {
26472647 dimension ("5Q" );
26482648 }
26492649
2650+ /**
2651+ * @throws Exception if any error occurs
2652+ */
2653+ @ Test
2654+ public void dimension_allowsEscapedHyphenInUnit () throws Exception {
2655+ // unit: a\-b => should be parsed as DIMENSION token, not "a" + MINUS + "b"
2656+ final String css = "p { top: 1a\\ -b; }" ;
2657+
2658+ final CSSStyleSheetImpl sheet = parse (css , 0 , 0 , 0 );
2659+ final CSSRuleListImpl rules = sheet .getCssRules ();
2660+
2661+ assertEquals (1 , rules .getLength ());
2662+ assertEquals ("p { top: 1a\\ -b; }" , rules .getRules ().get (0 ).getCssText ());
2663+ }
2664+
2665+ /**
2666+ * @throws Exception if any error occurs
2667+ */
2668+ @ Test
2669+ public void dimension_allowsNonAsciiInUnit () throws Exception {
2670+ // Use a non-ascii letter (e.g. Greek alpha).
2671+ final String css = "p { top: 1\u03B1 ; }" ; // 1α
2672+
2673+ final CSSStyleSheetImpl sheet = parse (css , 0 , 0 , 0 );
2674+ assertEquals ("p { top: 1\u03B1 ; }" , sheet .toString ());
2675+ }
2676+
2677+ /**
2678+ * @throws Exception if any error occurs
2679+ */
2680+ @ Test
2681+ public void dimension_allowsUnicodeEscapeInUnit () throws Exception {
2682+ // \61 == 'a'
2683+ final String css = "p { top: 1\\ 61bc; }" ;
2684+
2685+ final CSSStyleSheetImpl sheet = parse (css , 0 , 0 , 0 );
2686+ assertEquals ("p { top: 1\\ 61bc; }" , sheet .toString ());
2687+ }
2688+
2689+ /**
2690+ * @throws Exception if any error occurs
2691+ */
2692+ @ Test
2693+ public void dimension_allowsEscapeAfterStart () throws Exception {
2694+ // unit: a\31b => a1b
2695+ final String css = "p { top: 1a\\ 31b; }" ;
2696+
2697+ final CSSStyleSheetImpl sheet = parse (css , 0 , 0 , 0 );
2698+ assertEquals ("p { top: 1a\\ 31b; }" , sheet .toString ());
2699+ }
2700+
26502701 /**
26512702 * @throws Exception if any error occurs
26522703 */
0 commit comments