[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Proposed fix for bug 18337.
From: Michael Bedy <mjbedy () mediaone ! net>
Date: 2001-02-11 8:39:26
[Download RAW message or body]
Does this look ok? Should I commit? (This looks like Dirk's area...)
- Mike
["jscomment.diff" (TEXT/PLAIN)]
Index: html/htmltokenizer.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/htmltokenizer.cpp,v
retrieving revision 1.120
diff -u -r1.120 htmltokenizer.cpp
--- html/htmltokenizer.cpp 2001/02/09 14:09:31 1.120
+++ html/htmltokenizer.cpp 2001/02/11 08:33:32
@@ -136,6 +136,8 @@
listing = false;
processingInstruction = false;
script = false;
+ scriptComment = false;
+ slashSeen = 0;
style = false;
skipLF = false;
select = false;
@@ -260,6 +262,20 @@
checkScriptBuffer();
char ch = src[0].latin1();
+
+ // Keep track of javascript comments.
+ if (script && ch == '/')
+ slashSeen++;
+ else
+ slashSeen = 0;
+
+ if (slashSeen == 2)
+ scriptComment = true;
+
+ if (ch == '\r' || ch == '\n')
+ scriptComment = false;
+ // End javascipt comment tracking.
+
if ( (!script || tquote == NoQuote) && ( ch == '>' ) && ( searchFor[ searchCount ] == '>'))
{
++src;
@@ -367,7 +383,7 @@
}
}
// Is this perhaps the start of the </script> or </style> tag?
- else if ( ch == '<' || ch == '-' )
+ else if ( (ch == '<' || ch == '-') && scriptComment == false )
{
searchCount = 1;
searchBuffer[ 0 ] = src[0];
Index: html/htmltokenizer.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/htmltokenizer.h,v
retrieving revision 1.29
diff -u -r1.29 htmltokenizer.h
--- html/htmltokenizer.h 2001/02/07 21:03:51 1.29
+++ html/htmltokenizer.h 2001/02/11 08:33:32
@@ -218,6 +218,10 @@
// Are we in a <script> ... </script> block
bool script;
+ // Are we in a javascipt comment? (How many "/" in a row have we seen?)
+ bool scriptComment;
+ int slashSeen;
+
// Are we in a <style> ... </style> block
bool style;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic