Bug 102795 - [testcase] <dfn> elements don't all work in the same way
Summary: [testcase] <dfn> elements don't all work in the same way
Status: RESOLVED WORKSFORME
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-29 21:06 UTC by Paulo Moura Guedes
Modified: 2008-05-05 11:12 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Moura Guedes 2005-03-29 21:06:41 UTC
Version:            (using KDE Devel)
OS:                Linux

Hi,


In this page, http://www.iscte.pt/PA/glossario.html, the underlined words, which are "dfn" elements, are supposed to have a tooltip and point to a fragment identifier. Some of them are working and some of them are not, which is very weird.
Comment 1 Allan Sandfeld 2005-03-29 21:14:00 UTC
I don't know what they are supposed to do, but all the ones with a definition (title attribute) works just fine. 

It is just that most of them haven't got a definition.
Comment 2 Allan Sandfeld 2005-03-29 21:23:31 UTC
Sorry, was a bit too quick there. Firefox seems to handle all of them. The JS code uses either the termo attribute or the contents of the dfn tag to lookup the definition. It seems it mostly those dfn's with no termo or title that has problems. Which means it is probably this line that fails somehow:
termo = termos[i].innerHTML.toLowerCase().replace(/<[^>]*>/g, '').replace(/[ \n\r]+/g, ' ').replace(/^ +/g, '').replace(/&nbsp;/g, ' ')
Comment 3 Paulo Moura Guedes 2005-03-29 21:26:58 UTC
On Tuesday 29 March 2005 20:14, Allan Sandfeld wrote:
> ------- Additional Comments From kde carewolf com  2005-03-29 21:14 -------
> I don't know what they are supposed to do, but all the ones with a
> definition (title attribute) works just fine.
>
> It is just that most of them haven't got a definition.


Yes, but try those elements with mozilla...
It's javascript code that looks into all dfn elements and match their content 
with an associative array. It seems that the text nodes inside "dfn" 
elements, which have accentuated characters, doesn't work.

So, this probably should be marked as duplicate of #102793.
Comment 4 Paulo Moura Guedes 2005-03-29 22:06:56 UTC
On Tuesday 29 March 2005 20:23, Allan Sandfeld wrote:
> ------- Additional Comments From kde carewolf com  2005-03-29 21:23 -------
> Sorry, was a bit too quick there. Firefox seems to handle all of them. The
> JS code uses either the termo attribute or the contents of the dfn tag to
> lookup the definition. It seems it mostly those dfn's with no termo or
> title that has problems. Which means it is probably this line that fails
> somehow: termo = termos[i].innerHTML.toLowerCase().replace(/<[^>]*>/g,
> '').replace(/[ \n\r]+/g, ' ').replace(/^ +/g, '').replace(/&nbsp;/g, ' ')


The problem is that "if(termos[i].getAttribute("termo") != null)" is always 
true somehow.
Comment 5 Paulo Moura Guedes 2005-03-29 22:22:17 UTC
Simple test case:

<body>
    <dfn term="term attribute content">
        DFN element with term attribute.
    </dfn>
    <dfn>
        DFN element without term attribute.
    </dfn>

    <script language="JavaScript" type="text/JavaScript">
        var termos = document.body.getElementsByTagName("dfn");
        
        for(var i = 0; i != termos.length; ++i) {
            if(termos[i].getAttribute("term") != null)
                alert(termos[i].innerHTML + "has attribute: " + termos[i].getAttribute("term"));
            else
                alert(termos[i].innerHTML + "has no attribute.");
        }
    </script>
</body>
Comment 6 Manuel Sanz 2008-04-20 06:57:24 UTC
Fixed in 4.0.3.
Comment 7 FiNeX 2008-05-05 11:12:26 UTC
Fixed even in 3.5.9.