[svn r46] escaped CR trunk
authordglazman
Tue, 16 Mar 2010 05:35:36 -0500
branchtrunk
changeset 42 67149c16b5af
parent 41 070b030fd454
child 43 83dbf00720eb
[svn r46] escaped CR
cssParser.js
demo.xhtml
todo.txt
--- a/cssParser.js	Tue Mar 16 05:21:03 2010 -0500
+++ b/cssParser.js	Tue Mar 16 05:35:36 2010 -0500
@@ -303,11 +303,25 @@
     var s = aStop;
     var previousChar = aStop;
     while ((c = this.read()) != -1) {
-      if (c == aStop && previousChar != "\\") {
+      if (c == aStop && previousChar != CSS_ESCAPE) {
         s += c;
         break;
       }
-      s += c;
+      else if (c == CSS_ESCAPE) {
+        var c = this.peek();
+        if (c == -1)
+          break;
+        else if (c == "\n" || c == "\r" || c == "\f") {
+          c = this.read();
+        }
+        else {
+          s += this.gatherEscape();
+          c = this.peek();
+        }
+      }
+      else
+        s += c;
+
       previousChar = c;
     }
     return new jscsspToken(jscsspToken.STRING_TYPE, s);
--- a/demo.xhtml	Tue Mar 16 05:21:03 2010 -0500
+++ b/demo.xhtml	Tue Mar 16 05:35:36 2010 -0500
@@ -12,7 +12,8 @@
 h1 { background-color: silver }
 h2 { background-color: lightgrey }
 h1, h2 { margin: 0px; padding: 4px }}
-.foo { p\^roperty: value; bor\0000C4de: inherit }</style>
+.foo { content: "foo \
+bar" }</style>
   <script type="application/x-javascript"  src="cssParser.js"></script>
   <script type="application/x-javascript">
     function onLoad() {
--- a/todo.txt	Tue Mar 16 05:21:03 2010 -0500
+++ b/todo.txt	Tue Mar 16 05:35:36 2010 -0500
@@ -1,5 +1,5 @@
 DONE parse 'inherit' value for shorthands and individual properties
-- parse escaped chars and unicode chars
+DONE parse escaped chars and unicode chars
 DONE parse 'list-style' and 'outline' shorthands
 - try to link to browser's CSS OM (not sure it's feasible)
 - serialization controls