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 11:41:16 @@ -136,6 +136,9 @@ listing = false; processingInstruction = false; script = false; + scriptComment = false; + slashSeen = 0; + closeCommentSeen = 0; style = false; skipLF = false; select = false; @@ -260,6 +263,29 @@ 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 == '-') { + closeCommentSeen++; + } else if (ch == '>' && closeCommentSeen > 1) { + scriptComment = false; + closeCommentSeen = 0; + } else { + closeCommentSeen = 0; + } + + if (ch == '\r' || ch == '\n' || script == false) + scriptComment = false; + // End javascipt comment tracking. + if ( (!script || tquote == NoQuote) && ( ch == '>' ) && ( searchFor[ searchCount ] == '>')) { ++src; @@ -367,7 +393,7 @@ } } // Is this perhaps the start of the or tag? - else if ( ch == '<' || ch == '-' ) + else if ( (ch == '<' && scriptComment == false ) || ch == '-' ) { 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 11:41:16 @@ -218,6 +218,11 @@ // Are we in a block bool script; + // Are we in a javascipt comment? (How many "/" in a row have we seen?) + bool scriptComment; + int slashSeen; + int closeCommentSeen; + // Are we in a block bool style;