Version: (using KDE Devel) Installed from: Compiled sources Compiler: gcc version 3.3.5 20050117 (prerelease) (SUSE Linux) OS: Linux It seems that every link on www.sport1.de gets underlined while hovering over just one link. With Firefox and IE the page is shown correctly. Please fix this site, as it is the most popular sports site in germany. :-) Very best regards Michael
I can confirm this problem.
The problem is being caused by the floating <a name="oben"/> tag at the start of the body. This is not getting closed until after the three page layout divs hits the first real <a> tag, making the entire page into one big link. Simplified test case to follow. Firefox appears to be inserting a closing </a> automagically after the scripts and before the first <div>. Anyone have any idea why or what their logic is behind that?
Okay. This bug is related to residual styles. Basically if we have the structure: <a><div>Text <a>link</a></div> it gets rewritten to: <a></a><div><a>Text </a><a>link</a></div> (That is the unclosed anchor gets closed when it encounters an deeper anchor) But the residual styles cannot handle multiple levels, so <a><div><div>Text <a>link</a></div></div> Results in an open anchor, where it would gets closed in Firefox.
Created attachment 18203 [details] Patch Simple patch that tries do deal with multilevel residual element, by at least making sure we close the residual style.
Works like a charm Allan, great work! Will you include it in 3_5_BRANCH?
SVN commit 599348 by carewolf: Instead of giving up, atleast _close_ the residual style if it gets too complicated. Fixes sport1.de ;) BUG: 127662 CCMAIL:coolo@kde.org M +15 -8 htmlparser.cpp --- branches/KDE/3.5/kdelibs/khtml/html/htmlparser.cpp #599347:599348 @@ -1308,18 +1308,21 @@ void KHTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem) { - // Find the element that crosses over to a higher level. For now, if there is more than - // one, we will just give up and not attempt any sort of correction. It's highly unlikely that - // there will be more than one, since <p> tags aren't allowed to be nested. + // Find the element that crosses over to a higher level. + // ### For now, if there is more than one, we will only make sure we close the residual style. int exceptionCode = 0; HTMLStackElem* curr = blockStack; HTMLStackElem* maxElem = 0; + HTMLStackElem* endElem = 0; HTMLStackElem* prev = 0; HTMLStackElem* prevMaxElem = 0; + bool advancedResidual = false; // ### if set we only close the residual style while (curr && curr != elem) { if (curr->level > elem->level) { - if (maxElem) - return; + if (!isAffectedByResidualStyle(curr->id)) return; + if (maxElem) advancedResidual = true; + else + endElem = curr; maxElem = curr; prevMaxElem = prev; } @@ -1328,7 +1331,7 @@ curr = curr->next; } - if (!curr || !maxElem || !isAffectedByResidualStyle(maxElem->id)) return; + if (!curr || !maxElem ) return; NodeImpl* residualElem = prev->node; NodeImpl* blockElem = prevMaxElem ? prevMaxElem->node : current; @@ -1341,7 +1344,7 @@ if (!parentElem->childAllowed(blockElem)) return; - if (maxElem->node->parentNode() != elem->node) { + if (maxElem->node->parentNode() != elem->node && !advancedResidual) { // Walk the stack and remove any elements that aren't residual style tags. These // are basically just being closed up. Example: // <font><span>Moo<p>Goo</font></p>. @@ -1375,6 +1378,8 @@ if (isResidualStyleTag(currElem->node->id())) { // Create a clone of this element. currNode = currElem->node->cloneNode(false); + currElem->node->close(); + removeForbidden(currElem->id, forbiddenTag); // Change the stack element's node to point to the clone. currElem->setNode(currNode); @@ -1407,6 +1412,7 @@ SharedPtr<NodeImpl> guard(blockElem); blockElem->parentNode()->removeChild(blockElem, exceptionCode); + if (!advancedResidual) { // Step 2: Clone |residualElem|. NodeImpl* newNode = residualElem->cloneNode(false); // Shallow clone. We don't pick up the same kids. @@ -1433,6 +1439,7 @@ // Step 4: Place |newNode| under |blockElem|. |blockElem| is still out of the document, so no // attachment can occur yet. blockElem->appendChild(newNode, exceptionCode); + } // Step 5: Reparent |blockElem|. Now the full attachment of the fixed up tree takes place. parentElem->appendChild(blockElem, exceptionCode); @@ -1454,7 +1461,7 @@ // In the above example, Goo should stay italic. curr = blockStack; HTMLStackElem* residualStyleStack = 0; - while (curr && curr != maxElem) { + while (curr && curr != endElem) { // We will actually schedule this tag for reopening // after we complete the close of this entire block. NodeImpl* currNode = current;
thx!
*** Bug 137244 has been marked as a duplicate of this bug. ***