Firefox kills option.value white-space

R

Richard Maher

Hi,

Can someone please show me how to tell Firefox to preseve white-space when
returning the selectList.option[n].value attribute?

I have change the style so that the white-space is preserved on the screen,
but for some bizarre reason when I try to substring out a series of bytes
(aka a fixed-length string or field) from a given option it squashes
everything up and corrupts the result.

Cheers Richard Maher

BTW. Works fine on IE.
 
R

RobG

Hi,

Can someone please show me how to tell Firefox to preseve white-space when
returning the selectList.option[n].value attribute?

I have change the style so that the white-space is preserved on the screen,
but for some bizarre reason when I try to substring out a series of bytes
(aka a fixed-length string or field) from a given option it squashes
everything up and corrupts the result.

The value of an option element is CDATA[1], about which the W3C HTML 4
specification says:

"User agents may ignore leading and trailing white space
in CDATA attribute values (e.g., " myval " may be
interpreted as "myval"). Authors should not declare attribute
values with leading or trailing white space."

BTW. Works fine on IE.

Hooray for IE, however both IE and Firefox are consistent with the
spec.


1. <URL: http://www.w3.org/TR/html4/interact/forms.html#adef-value-OPTION
 
R

Richard Maher

Hi Rob,

Thanks for the reply.
The value of an option element is CDATA[1], about which the W3C HTML 4
specification says:

[ambiguous non-committal crap :-]

Anyway, I was able to work out that my x.options[x.length] = new
Option(string,pos) should've been (string,string) and then if I returned the
options[n].VALUE rather than .TEXT I managed to get the white-space intact.

Just another part of browsers' rich tapestry I suppose :)

Please bear with me as there's bound to be a few more of these. I'm not an
IE (or Microsoft) lover, but (at first glance) Firefox doesn't seem to be
all it's cracked up to be. How do you get Firebug going 'cos at least IE
gave you the line number it barfed at. (Come to think of it, at least it
barfed in the first place and let you double-click on the error rather than
this Firefox deathly silence)

Cheers Richard Maher

RobG said:
Hi,

Can someone please show me how to tell Firefox to preseve white-space when
returning the selectList.option[n].value attribute?

I have change the style so that the white-space is preserved on the screen,
but for some bizarre reason when I try to substring out a series of bytes
(aka a fixed-length string or field) from a given option it squashes
everything up and corrupts the result.

The value of an option element is CDATA[1], about which the W3C HTML 4
specification says:

"User agents may ignore leading and trailing white space
in CDATA attribute values (e.g., " myval " may be
interpreted as "myval"). Authors should not declare attribute
values with leading or trailing white space."

BTW. Works fine on IE.

Hooray for IE, however both IE and Firefox are consistent with the
spec.


1. <URL: http://www.w3.org/TR/html4/interact/forms.html#adef-value-OPTION
 
R

Richard Maher

Hi Duncan,

A lot of things in Firebug's console are clickable: click on the line
number associated with an error message and it jumps you to the relevant
line in the debugger, click on an object value and you can browse its
properties. Use console.log to output clickable objects in tracing
statements:

Now this is excellent! Thanks for the pointer.

I had to get the console up via "tools/error console" but now I'm there and
love what I see so far.

Cheers Richard Maher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top