Closed Bug 243266 Opened 20 years ago Closed 17 years ago

insertBefore of WBR does not cause reflow

Categories

(Core :: Layout, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: taralx, Unassigned)

References

()

Details

(Keywords: testcase)

Attachments

(2 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8

The URL is a bookmarklet that breaks up long links and such to avoid
over-stretching the page. It does so by adding WBR tags to the link text.
However this does not trigger a reflow. Modifying the bookmarklet to add BR tags
instead DOES trigger a reflow.

If the WBR tags are present at initial render time, it renders correctly. Use 

Reproducible: Always
Steps to Reproduce:
1. Go to http://www.yabbse.org/community/index.php?thread=27432
2. Execute bookmarklet.

Actual Results:  
Nothing.

Expected Results:  
Reflow should wrap the link text.
Attached file Testcase (obsolete) —
Created a testcase. After clicking the button, the third table should look like
the second.
Keywords: testcase
Attached file testcase
The previous testcase had two elements with id "big", so the <wbr> was being
added in the wrong place.  I also made the testcase work in IE (added a missing
quote) and added a button that forces a relayuot.
Attachment #148315 - Attachment is obsolete: true
Status: UNCONFIRMED → NEW
Ever confirmed: true
This should work:

javascript:(function(){var D=document; F(D.body); function F(n){var u,r,c,x; if(n.nodeType==3){ u=n.data.search(/\S{45}/); if(u>=0) { r=n.splitText(u+45); n.parentNode.insertBefore(D.createElement(%22WBR%22),r); } }else if(n.tagName!=%22STYLE%22 && n.tagName!=%22SCRIPT%22){for (c=0;x=n.childNodes[c];++c){F(x);}} } })(); document.body.parentNode.insertBefore(document.body, document.body); void 0;

Credit to Jim Roberts a.k.a. _Jim_ from MozillaZine Forums.

The reflow branch landing fixed this.  Test added to reftest suite.
Status: NEW → RESOLVED
Closed: 17 years ago
Depends on: reflow-refactor
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: