Bug 149771

Summary: responseXML from AJAX request renames <image> tags to <img>
Product: [Applications] konqueror Reporter: Christopher Staite <chris>
Component: khtml parsingAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: kde, maksim, porten
Priority: NOR    
Version: 3.5.7   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Christopher Staite 2007-09-11 12:52:56 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    Ubuntu Packages
OS:                Linux

When retrieving responseXML from an AJAX request the XML tags <image> are renamed to <img> during parsing, but are correct in responseText.

There is not much more to say.  I assume this is due to using the same parser as the XHTML parser and for some reason that feels it should rename this tag.  It breaks my application anyway, and I'm not sure that writing a workaround for it is the best solution.
Comment 1 Maksim Orlovich 2007-09-12 02:57:13 UTC
Ugh. I can believe that. The problem is probably[1] that we assign each element's local name an ID, and <img> and <image> get mapped to the same one for backwards (we are talking html3 or something) compatibility reasons. Which is sort of reasonable for HTML, but since the IDs are used for other namespaces... Seems like this should be done in some special way by the html parser only. (same for other legacy mappings like <anchor> -> <a>, <listing> -> 
<pre>). A reasonably option may be to give them own IDs, and use the factory code in the parser (why does it exist, anyway?) to create HTMLImageElement or whatever for them. 

[1] Unless it's due to our "creative" (aka quite buggy) namespace handling

A fun testcase to ponder (actually Opera 9.21 renders it as we do!):

<style>
image#i1 { border: 10px solid red; }
img#i2   { border: 10px solid  green; }
</style>
<image id="i1" src="http://bugs.kde.org/media/images/kde_gear_64.png">
<image id="i2" src="http://bugs.kde.org/media/images/kde_gear_64.png">
<script>
alert(document.createElement("image").nodeName);
</script>
Comment 2 Maksim Orlovich 2007-09-12 03:06:45 UTC
A nicer(?) testcase:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:tst="http://bugs.kde.org/show_bug.cgi?id=149771">
    <style>
        @namespace tst url(http://bugs.kde.org/show_bug.cgi?id=149771);
        tst|image[attr=i1] { background-color:green; }
        tst|img[attr=i1]   { background-color:red; }
        tst|img[attr=i2]   { background-color:green; }
        tst|image[attr=i2] { background-color:red; }
    </style>
    
    <div><tst:image attr="i1">This should be green</tst:image></div>
    <div><tst:img attr="i2">This should be green</tst:img></div>
</html>
Comment 3 Harri Porten 2008-10-05 05:48:51 UTC
As of rev 867535 (future KDE 4.2) "image" and "img" are not treated the same anymore so your problem should be fixed. But now support for the legacy <image> has to be restored...
Comment 4 Janek Bevendorff 2012-06-18 17:24:51 UTC
Message from the Bugsquad and Konqueror teams: This bug is closed as outdated, as we do not have the manpower to maintain the KDE3 version anymore. If you still can reproduce this issue with Konqueror 4.8.4 or later, please open a new report. Thank you for your understanding.