Werner Schalk <[EMAIL PROTECTED]> writes:

> I use HTML::Parser to find all comments within a given html file and this 
> works pretty fine. But how can I find or search for comments like this with
> HTML::Parser:
> 
> <script language="JavaScript">
> <!--
>         br=GetBrowser(true);
> 
>         if (br==1)
>                 self.location.href="IE/index.php";
>         else
>                 self.location.href="NS/index.php";
> // -->
> 
> I suppose because of the "// -->" part the comment is not found by 
> HTML::Parser?

No, it is because <script> elements are different.  No comment is
recognized within a <script> element.  Same treatment happen for
<style>, <textarea> and <xmp>.  You will have to special case these
tags.  If you don't care you might be able to just enable:

   $p->ignore_elements(qw(script style));

Regards,
Gisle

Reply via email to