The default bug view has changed. See this FAQ.

textarea.wrap not exposed through DOM (IE compatability)

RESOLVED FIXED in mozilla1.9.3a2

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
17 years ago
7 years ago

People

(Reporter: Martin Honnen, Assigned: Ms2ger)

Tracking

({dev-doc-complete, dom0, testcase})

Trunk
mozilla1.9.3a2
dev-doc-complete, dom0, testcase
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

17 years ago
Textarea elements have a
  wrap
attribute which can have values
  off
  hard
  soft
While mozilla supports setting those via html it fails to change the wrapping 
when the attribute is changed via javascript. IE5 does that nicely.
(Reporter)

Comment 1

17 years ago
Created attachment 9590 [details]
bug demo (button click changes the wrap property but wrapping inside the textarea is not changed)
Reassigning to Eric, but I'm not sure if pollmann, rods, or mjudge owns this 
one.
Assignee: rods → pollmann

Comment 3

17 years ago
Hm, I tried returning a hint of REFLOW and FRAMECHANGE for that attribute change 
in nsHTMLTextAreaElement::GetMappedAttributeImpact and neither seemed to have 
any effect.  It would be good to get this working in the Ender lite version, so 
I'll work with Mike try that...
Status: NEW → ASSIGNED

Comment 4

17 years ago
Ah, okay...  So the reason why this does nothing is that it is not part of the 
DOM spec.  See:

http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/html.html#ID-24874179

We have a fairly strict interpretation of the spec in most cases, so that is why 
this attribute is not exposed through the DOM.  I'm CC'ing our DOM guy to see if 
it make sense to add this to our proprietary extensions (i.e. add it to 
NSHTMLTextAreaElement in the idl file)
Component: HTML Form Controls → DOM Level 0
OS: Windows 98 → All
Hardware: PC → All
Summary: change of wrap attribute of textarea without visual effect → textarea.wrap not exposed through DOM (IE compatability)
I think it should be possible to solve this without changing any DOM code or
interfaces, the actual wrapping of the text is done in the editor in the
textarea frame (AFAIK) and the testcase here shows that setting and getting the
value of the .wrap property (which just maps to the attribute getter/setter)
does work. It looks like the problem is that the textarea should be reflown when
the wrap attribute changes and nsGfxTextControlFrame::Reflow() needs to change
the wrapping in the editor in the textarea frame...

Comment 6

17 years ago
Hmm..  After some testing, I found that we actually do need to change the idl 
interfaces in the DOM in order to let the GfxTextControlFrame know that it needs 
to reflow when the wrap property changes (specifically, adding a wrap attribute 
line to NSHTMLTextAreaElement inside HTMLTextAreaElement.idl).  I've got all the 
changes in my tree needed to fix this bug, though with the change we are giving 
a hint of FRAMECHANGE instead of REFLOW which is not the most efficient way to 
do things (but better than not doing them at all).
Whiteboard: fix in hand
Target Milestone: --- → M17
Hmm, ok, or would it be possible to make this change in
GfxTextControlFrame::AttributeChanged() (plus the DOM changes) and avoid hinting
about possibly unnecessary reflows?

Comment 8

17 years ago
Thanks, I didn't try that yet, I'll give it a whirl!
Whiteboard: fix in hand

Updated

17 years ago
Keywords: testcase

Comment 9

17 years ago
This bug has been marked "future" because the original netscape engineer working 
on this is over-burdened. If you feel this is an error, that you or another 
known resource will be working on this bug,or if it blocks your work in some way 
-- please attach your concern to the bug for reconsideration.
Target Milestone: M17 → Future
Keywords: dom0

Comment 10

16 years ago
->gerardok
QA Contact: ckritzer → gerardok

Updated

16 years ago
QA Contact: gerardok → desale

Comment 11

16 years ago
Created attachment 28528 [details] [diff] [review]
ancient patch to expose this...
Bulk reassigning Eric Pollmann's remaining form submission bugs to Alex.
Assignee: pollmann → alexsavulov
Status: ASSIGNED → NEW
Fabian, wanna fix this one now? This one should be trivial now that we're using
XPConnect to talk to the DOM from JS.

Comment 14

16 years ago
I had this one on my radar just never took the time to investigate it. Will look :-)

Comment 15

16 years ago
So uh... I mapped .wrap to Get/SetAttribute, but it doesn't do anything. Then I
did a static HTML file with attributes wrap="off", wrap="soft", wrap="hard", and
all of them displayed in the same way??
Do we actually support this attribute?
(Reporter)

Comment 16

16 years ago
When I filed this bug (4 June 2000) Mozilla at that time supported the wrap
attribute for textarea elements. It doesn't seem to do it anymore. So it might
seem we first need a 4xp compatibility bug (as wrap is not part of HTML 4)
Hmm, I still see wrapping related code in nsGftTextControlFrame2.cpp, Rod, did
support for the "wrap" attribute regress lately?
Should this bug be marked as invalid ? We do not seem to support wrap which is
not part of the w3c specs. It is not a 4xp compatibilty issue since NS4 didn't
support this part of IE DOM either. RFE ?
(Reporter)

Comment 19

14 years ago
When I try the test case
  http://bugzilla.mozilla.org/attachment.cgi?id=9590&action=view
with the Mozilla 1.3 release build on Win 98 then the wrap="off" setting for the
<textarea> element is recognized, the text line is not wrapped and a horizontal
scrollbar is displayed. Thus at least Mozilla 1.3 supports the HTML attribute
wrap for <textarea> elements and I think it should be scriptable as a property
as well.
To default owners.
Assignee: alexsavulov → general
Priority: P3 → --
QA Contact: desale → ian
Target Milestone: Future → ---
Editor questions:

1)  Would it be OK to make SetWrapWidth be a no-op when the width is being set to
    the value it already is?
2)  Would it be OK to change the default wrap width value to -1 (so that regular
    text controls don't take a perf hit from editor munging styles that are
    already correctly set)?

Comment 22

12 years ago
*** Bug 302710 has been marked as a duplicate of this bug. ***

Comment 23

12 years ago
See <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/750fa0da420a46a6/eb9efd932d383526?hl=en#eb9efd932d383526> 
for much simplier fix found by BootNic: 
...
txtarea.setAttribute('wrap', mode): 
/*Fix display for mozilla*/ 
txtarea.style.display='none'; 
txtarea.style.display=''; 
...

So it's a rendering failure, not a property access problem. So stop saying wise words and fix it ;-) 

Eric Pollmann wrote:
> So the reason why this does nothing is that it is not part of the 
DOM spec.

Oh com'on guys! Textarea doesn't have wrap property? That's a hot discover since 1995. The only reason it's not on the triple-W site is (I guess) that wrap still have double set of arguments supported:
legacy "off", "virtual", "physical" from the golden era of Netscape
newer "off", "soft", "hard" from Microsoft.

As it happens often in such situations, triple-W prefers to keep silence until it's clear where the wind is coming from.

Comment 24

11 years ago
Created attachment 216983 [details]
Textarea tester: Dynamically change .wrap; View submission

Truly, it would be nice to have this fixed.  As regards VK's comments and the notes in Bug 302710.  I could not get any of those methods to work for me in FF 1.5.0.1 on my Win 2K Pro.  Furthermore, it is not simply a display issue (as you may verify by this attachment - but remember to uncheck the checkbox for it), since dynamically changing the .wrap setting (between hard and anything else) and then submitting the textarea does not alter what gets submitted to the server.

The attachment does demonstrate a workaround, however.  Essentially, it is:
  function elem(id) { return document.getElementById(id); }
  ta = elem('myTextareaId');
  ta.setAttribute("wrap",newWrapVal);
  var oldValue = ta.value;
  ta.parentNode.replaceChild(ta.cloneNode(true), ta);
  elem('myTextareaId').value=oldValue;

Whenever the checkbox in the attachment is checked, the workaround is in effect.  You can notice it on the client if you are switching to/from a wrap setting of off.  You can notice it on the server when switching to/from a wrap setting of hard.

Csaba Gabor from Vienna

Comment 25

11 years ago
This isn't just IE compatibility - XUL textboxes have a wrap attribute and are affected by the same issue.

Updated

10 years ago
Depends on: 159979
Assignee: general → nobody
QA Contact: ian → general
(Assignee)

Comment 26

7 years ago
Created attachment 425002 [details] [diff] [review]
Patch v1

This should fix bug 159979 as well.
Attachment #425002 - Flags: review?(bzbarsky)
Attachment #425002 - Flags: review?(bzbarsky) → review+
(Assignee)

Updated

7 years ago
Assignee: nobody → Ms2ger
Keywords: checkin-needed

Updated

7 years ago
Attachment #28528 - Attachment is obsolete: true

Updated

7 years ago
Blocks: 159979
No longer depends on: 159979
http://hg.mozilla.org/mozilla-central/rev/ada1992ccacb
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1

Updated

7 years ago
Target Milestone: mozilla1.9.3a1 → mozilla1.9.3a2

Comment 28

7 years ago
dev-doc-needed to be included in the next "what's new?"
Keywords: dev-doc-needed
(Assignee)

Comment 29

7 years ago
I've added notes to <https://developer.mozilla.org/en/DOM/TextArea> and <https://developer.mozilla.org/en/Upcoming_Firefox_features_for_developers>. Is anything else needed?
No, not now. Eventually this will be documented more fully when textareas are properly documented.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.