Closed Bug 41464 Opened 24 years ago Closed 14 years ago

textarea.wrap not exposed through DOM (IE compatability)

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a2

People

(Reporter: martin.honnen, Assigned: Ms2ger)

References

Details

(Keywords: dev-doc-complete, dom0, testcase)

Attachments

(3 files, 1 obsolete file)

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.
Reassigning to Eric, but I'm not sure if pollmann, rods, or mjudge owns this 
one.
Assignee: rods → pollmann
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
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...
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?
Thanks, I didn't try that yet, I'll give it a whirl!
Whiteboard: fix in hand
Keywords: testcase
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
->gerardok
QA Contact: ckritzer → gerardok
QA Contact: gerardok → desale
Attached patch ancient patch to expose this... (obsolete) — Splinter Review
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.
I had this one on my radar just never took the time to investigate it. Will look :-)
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?
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 ?
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)?
*** Bug 302710 has been marked as a duplicate of this bug. ***
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.
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
This isn't just IE compatibility - XUL textboxes have a wrap attribute and are affected by the same issue.
Depends on: 159979
Assignee: general → nobody
QA Contact: ian → general
Attached patch Patch v1Splinter Review
This should fix bug 159979 as well.
Attachment #425002 - Flags: review?(bzbarsky)
Attachment #425002 - Flags: review?(bzbarsky) → review+
Assignee: nobody → Ms2ger
Keywords: checkin-needed
Attachment #28528 - Attachment is obsolete: true
Blocks: 159979
No longer depends on: 159979
http://hg.mozilla.org/mozilla-central/rev/ada1992ccacb
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
Target Milestone: mozilla1.9.3a1 → mozilla1.9.3a2
dev-doc-needed to be included in the next "what's new?"
No, not now. Eventually this will be documented more fully when textareas are properly documented.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: