Property IHtmlElementCollection.all broken by script tag in HTML file

403 views Asked by At

I am having a bit of trouble with IHtmlElementCollection used from Delphi XE2. My document looks something like this, and I load it into TWebBrowser.

<!DOCTYPE html>
<html>
<head>
<title>Test av skjema</title>
  <script type="text/javascript" src="Header.js" ></script>      
  <style>
    body{ font-family: 'Segoe UI'; font-size: 9pt; }
    table{ background-color: silver; width=98%; }
   td{ background-color: white; vertical-align: top; padding: 2px; }
   .fullWidth{ width: 100%; border: 0px solid white; }
   .noFrame{ border: 0px solid white; overflow: hidden; width=100%; }
   .Header{ font-weight: bold; }
   .Question{ font-size: 9pt }
    .HelpText{ font-size: 8pt; color: navy; }
  </style>
</head>
<body>
<form>
 ...
</form
</body>
</html>

When I try to iterate over all elements in the document using the IHtmlDocument2 interface, the "all" property will only contain the elements up to the script, for a total of 5 IHtmlElement objects. After that, there are no more elements to find.

However, when I remove the tag:

<script type="text/javascript" src="Header.js" ></script>      

the iterator will once again find all elements of the file, which is a great deal more. Does anyone know why this happens?

0

There are 0 answers