Alaska Software Inc. - HRF- GetelementByID() wrong element found
Username: Password:
AuthorTopic: HRF- GetelementByID() wrong element found
Thomas Braun
HRF- GetelementByID() wrong element found
on Thu, 18 Feb 2010 10:52:43 +0100
Hi,

consider the following HTML markup:

...
<div id="content-header">
...
</div>
<div id="content">
...
</div>
<div od="content-footer">
...
</div>

When trying to find the div with the id "content", GetElementByID does not
use exact matching, but matches on leading substrings as well:

oHtml:GetElementByID("content") -> this finds "content-header" instead
because this is the first occurance in the child list.

Obviously, HRF does not use "==" for string comparisons.

I tried to work around this by using oHtml:GetElementByID("content ")
(trailing space), but then the element is not found at all (shouldn't IDs
be trimmed internally before searching?

Unfortunately, I now have to change a lot of HTML templates because of this
totally unexpected behaviour.This can be a real showstopper if you don't
have control over the HTML markup.

I did not check but I suspect that this problem exists for the other
GetElement...functions as well.

Thomas
Thomas Braun
Re: HRF- GetelementByID() wrong element found
on Thu, 18 Feb 2010 10:56:08 +0100
Thomas Braun wrote:

> When trying to find the div with the id "content", GetElementByID does not
> use exact matching, but matches on leading substrings as well:

Just found out this most likely has been fixed with 1.82.306 - PDR 5305

Thomas