[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: Proposed fix for bug 18337.
From: Michael Bedy <mjbedy () mediaone ! net>
Date: 2001-02-11 9:46:12
[Download RAW message or body]
Replying again. Perhaps this patch is better..
- Mike
On Sun, 11 Feb 2001, Michael Bedy wrote:
>
> Hmm... (Replying to self.) Maybe it's not this simple.... What has to
> happen here? Should everything after the // on a line be ignored? Maybe it
> still has to look for -->, but not </script>....
>
> Opinions?
>
> - Mike
>
>
> On Sun, 11 Feb 2001, Michael Bedy wrote:
>
> >
> > 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 09:41:11
@@ -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' || script == false)
+ 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 == '<' && 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 09:41:11
@@ -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