Fix multi-line comment and CDATA matching.
authorJuriy Zaytsev <kangax@gmail.com>
Sat, 6 Feb 2010 04:51:19 +0000 (23:51 -0500)
committerJuriy Zaytsev <kangax@gmail.com>
Sat, 6 Feb 2010 04:51:19 +0000 (23:51 -0500)
htmlparser.js

index a58e9f0..7352119 100644 (file)
                                }
 
                        } else {
-                               html = html.replace(new RegExp("(.*)<\/" + stack.last() + "[^>]*>"), function(all, text){
-                                       text = text.replace(/<!--(.*?)-->/g, "$1")
-                                               .replace(/<!\[CDATA\[(.*?)]]>/g, "$1");
+                               html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function(all, text){
+                                       text = text
+                                         .replace(/<!--([\s\S]*?)-->/g, "$1")
+                                               .replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, "$1");
 
                                        if ( handler.chars )
                                                handler.chars( text );