Open Bug 59248 Opened 24 years ago Updated 2 years ago

[FIX?]<OPTION> values lose embedded spaces

Categories

(Core :: Layout: Form Controls, defect)

x86
Linux
defect

Tracking

()

Future

People

(Reporter: dwallace, Unassigned)

References

Details

Attachments

(4 files)

<OPTION value="xx  yy"> results in a loss of embedded spaces, in the given case
the two spaces are reduced to one.

the version I'm using:

Mozilla/5.0 (X11; U; Linux 2.2.16 i686; en-US; m18) Gecko/20001105
I see this as well. Confirming bug.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I wonder if we can use white-space: nowrap style for options?
Status: NEW → ASSIGNED
Summary: <OPTION> values loose embedded spaces → [FIX?]<OPTION> values loose embedded spaces
*** Bug 67144 has been marked as a duplicate of this bug. ***
Target Milestone: --- → Future
Attached file testcase
We're doing this deliberately, in nsHTMLOptionElement::GetText.  We call
CompressWhitespace(), which I assume is what ... well, compresses the whitespace.

bug 30471 would probably benefit from the fix to this.
Assigning to right component.
Component: Form Submission → HTML Form Controls
Priority: P3 → --
*** Bug 127851 has been marked as a duplicate of this bug. ***
Blocks: 30471
There's probably a reason why not, but I'll ask anyway: At

http://lxr.mozilla.org/seamonkey/source/content/html/content/src/nsHTMLOptionEle
ment.cpp#558

why don't we simply remove the call to CompressWhiteSpace?  It would at least 
solve the leading whitespace problem in bug 30471.  Is it because you want to 
trim the trailing whitespace?
See
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/content/html/content/src/nsHTMLOptionElement.cpp&rev=&cvsroot=/cvsroot&rev=1.59#508
-- hover over the revision number to get a popup telling you what the checkin
comment was....

Looks like it was done for compat with something of some sort; that should
really be the only consideration here, imo.  If we can improve compat with IE in
that code, we should.
I did some tests and it turns out you already have compatibility in this bug :-
)  This is pretty much fixed AFAICT.  The only gap between the two is when 
adding options via script, which is bug 30471.  Would this indicate that, in 
IE, the HTML parser strips out the whitespace, so that post-parsing options 
aren't affected by it?  (Or am I just making wild guesses here?)
Summary: [FIX?]<OPTION> values loose embedded spaces → [FIX?]<OPTION> values lose embedded spaces
Sterling Bates, are you saying that identical <option> DOM nodes will render
differently in IE?  Any chance of attaching a testcase demonstrating the IE
behavior (with a clear description of the IE behavior in the testcase, since I
have no IE to test with)?
IE renders the two drop downs differently, depending on script vs. HTML
declaration.  Mozilla renders both exactly the same, which falls under the
other bug I refered to.  I'll attach an image comparing IE and Mozilla outputs.
In that testcase, do the textnodes inside the <option>s have the same text for
both types of options in IE?

Another possibility is that in Mozilla, when you do |new Option("foo")| that's
equivalent to doing <option>foo</option>.  In IE, it could be equivalent to
<option label="foo"></option>...

For that matter, how does layout of <option label="  aaa"> compare with 
<option>  aaa</option> in IE?

Thanks for your time, Sterling... if we can get a handle on what IE does here
and it it's sane....
Actually IE doesn't even recognize the label attribute of option.  After 
looking at http://www.blooberry.com/indexdot/html/tagpages/o/option.htm, I 
found that no browser does (as of its last update).
Oh, indeed...  I thought we did, but it looks like bug 4050 was just a bad dream.

So back to my other question.  Are the textnodes in IE identical for the two
<option>s (the one from script and the one not from script)?
Sorry, missed that one :)  They are identical.
So given two identical DOM nodes IE is rendering them differently?  I'm sorry,
but  I doubt Mozilla will start doing that... :(

If I may ask, how did you compare the textnodes?
I knew I should've asked you about the textnode thing.  It's been a long day 
(first kid born today), and I didn't give it proper attn.  Are you referring to 
the equivalent of Mozilla's DOM nodes in javascript?  If so, I did not do 
this.  I was just comparing visual rendering.  I'll have to do a more in-depth 
check on this either Saturday night or Sunday.
> Are you referring to the equivalent of Mozilla's DOM nodes in javascript?

Yeah, exactly.  Specifically, I'm talking about things like

  optionObject.firstChild.nodeValue  

(which is the text string in the text text node inside the option that
optionObject points to).  Basically, once the selects are constructed it would
be good to grab corresponding options from the two and compare the nodeValues...
I'll upload a modification of your testcase to that effect.
Attached file Something like this
I hope IE can handle that... If not, that at least gives a general idea.
That worked great.  Here's the output:

Value 1: '9 0 1 2', length is 7
Value 2: '    9   0   1   2', length is 17

This reflects exactly what's inside the dropdown: Value 1 is modified, Value 2 
is not.
So the upshot is that IE's parsing of <option> is totally wacky...

I'm not even sure we can do that, in good conscience, since it would break
Composer round-tripping...
Blocks: 138070
*** Bug 244632 has been marked as a duplicate of this bug. ***
Assignee: rods → nobody
Status: ASSIGNED → NEW
QA Contact: vladimire → layout.form-controls
Severity: normal → S3

The severity field for this bug is relatively low, S3. However, the bug has 3 duplicates.
:emilio, could you consider increasing the bug severity?

For more information, please visit auto_nag documentation.

Flags: needinfo?(emilio)

We force white-space: nowrap on combobox <select>. Maybe we shouldn't.

Flags: needinfo?(emilio)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: