By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,602 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

Firefox kills option.value white-space

P: n/a
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.
Jul 3 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Jul 3, 3:44 pm, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
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."

<URL: http://www.w3.org/TR/html4/types.html#type-cdata >

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/...f-value-OPTION
>
--
Rob

Jul 3 '07 #2

P: n/a
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" <rg***@iinet.net.auwrote in message
news:11*********************@g37g2000prf.googlegro ups.com...
On Jul 3, 3:44 pm, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
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."

<URL: http://www.w3.org/TR/html4/types.html#type-cdata >

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/...f-value-OPTION
--
Rob


Jul 3 '07 #3

P: n/a
"Richard Maher" <ma******@hotspamnotmail.comwrote:
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)
If you get a javascript error then firebug will tell you this in red near
the right hand end of the status bar. e.g. '1 Error'. Click on this and it
will open Firebug's console view (or open firebug with F12 and select the
console view manually). Once in the console view you should be able to see
the error message.

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:

console.log('Foobar current value is %o', foobar);

Also at the console prompt you can type in an expression and again the
result (if it isn't just a simple value) can be clicked on and browsed.
Jul 3 '07 #4

P: n/a
Hi Duncan,

"Duncan Booth" wrote: -
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

"Duncan Booth" <du**********@invalid.invalidwrote in message
news:Xn************************@127.0.0.1...
"Richard Maher" <ma******@hotspamnotmail.comwrote:
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)

If you get a javascript error then firebug will tell you this in red near
the right hand end of the status bar. e.g. '1 Error'. Click on this and it
will open Firebug's console view (or open firebug with F12 and select the
console view manually). Once in the console view you should be able to see
the error message.

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:

console.log('Foobar current value is %o', foobar);

Also at the console prompt you can type in an expression and again the
result (if it isn't just a simple value) can be clicked on and browsed.

Jul 4 '07 #5

P: n/a
"Richard Maher" <ma******@hotspamnotmail.comwrote:
>
"Duncan Booth" wrote: -
>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.
That's a different error console. Tools/error console gives you the
standard Firefox error console. Tools/firebug/open firebug will give you
firebug (assuming you have it installed - if not, install it now).
Jul 4 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.