Bug 29540 - [Qt] Problem with QWebElement toInnerXml() and toOuterXml() if HTML source contains closed tags
Summary: [Qt] Problem with QWebElement toInnerXml() and toOuterXml() if HTML source co...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks: Qt46
  Show dependency treegraph
 
Reported: 2009-09-21 04:58 PDT by Tor Arne Vestbø
Modified: 2009-10-06 03:51 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø 2009-09-21 04:58:09 PDT
This bug report originated from Nokia internal issue QT-695

--- Description ---

QWebElement generate bad output for toInnerXml and toOuterXml methods if source HTML contains solo tags. QWebElement tread closed tags (ex. <tag/>) as if they include data normaly following them .

For example:
--------------------

  source html:
<tag><childtag/>some text</tag>

  result toInnerHtml() for <tag> element should be:
<childtag/>some text or '<childtag></childtag>some text

  but it was:
<childtag>some text</childtag>

  result toOuterHtml() for <tag> element should be:
<tag><childtag/>some text</tag> or '<tag><childtag></childtag>some text</tag>

  but it was:
<tag><childtag>some text</childtag></tag>
Comment 1 Kenneth Rohde Christiansen 2009-10-05 05:12:11 PDT
I don't really see the point. This is how they are treated internally, and the functions do start with "to", indicating some kind of conversion.

Would be fun to see what jQuery returns?
Comment 2 Tor Arne Vestbø 2009-10-05 05:19:09 PDT
Both Safari and Firefox has this behavior:

data:text/html,<p id="para"><br/>foo</p>

document.getElementById("para")
<p id=​"para">​
document.getElementById("para").innerHTML
<br>foo
document.getElementById("para").outerHTML
<p id="para"><br>foo</p>
Comment 3 Jędrzej Nowacki 2009-10-05 07:58:37 PDT
The output is broken, it is true but:
1. HTML doesn't support closed tags, XHTML does.
2. nobody care, I'm pretty sure it is my request, closed in Hooligan and (badly?) migrated to Jira and than to bugzilla.
Comment 4 Tor Arne Vestbø 2009-10-06 03:51:47 PDT
Can't reproduce this in trunk