Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Firefox kills option.value white-space

Reply
Thread Tools

Firefox kills option.value white-space

 
 
Richard Maher
Guest
Posts: n/a
 
      07-03-2007
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.


 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      07-03-2007
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

 
Reply With Quote
 
 
 
 
Richard Maher
Guest
Posts: n/a
 
      07-03-2007
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" <> wrote in message
news: 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
>




 
Reply With Quote
 
Richard Maher
Guest
Posts: n/a
 
      07-04-2007
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" <> wrote in message
news:Xns99628D03413Fduncanbooth@127.0.0.1...
> "Richard Maher" <> wrote:
>
> > 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AOL Kills Netscape's Future, Leaves Firefox To Battle IE History Fan Firefox 9 01-05-2008 04:13 AM
FireFox 1.5 install kills Thunderbird 1.5 Dave_s Firefox 0 03-28-2006 12:31 AM
firefox 1.5 install kills thunderbird 1.5 Dave_s Firefox 0 03-27-2006 08:44 PM
firefox kills wlan adapter Michael Leithold Firefox 0 02-19-2006 03:01 PM
upgrade from 1.04 to 1.05 kills firefox zutroi Firefox 8 07-14-2005 07:53 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57