[thelist] modified <pre></pre> blocks

.jeff jeff at members.evolt.org
Wed Jul 17 14:54:01 CDT 2002


andy,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Hardacker, Andrew
>
> Jeff, very nifty JavaScript. But as a Mozilla fan, I was
> disappointed not to get the full effect.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

agreed.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> There are valid core DOM alternatives to the Microsoft
> DOM extensions. By changing a couple lines of Javascript
> and a couple lines of CSS this can work in Mozilla 1.0.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

i can make it work as far as the display goes.  however, once you
copy-n-paste you'll see why i removed the code that made it work in nn6/moz.
it annoyingly included the line numbers in the text that's copied. win/ie5+
does not do this and i've therefore stuck with this approach and limited it
to that browser/os combination.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> .pseudoPreOL {
>   list-style-position: outside; /* set numbers outside
>                                    list, they won't
>                                    cut-n-paste */
>   border: 1px dashed gray;
> }
>
> .pseudoPreLI {
>   background-color: #eeeeee; /* move background
>                                 color to LI */
>   font-family: monospace;
>   color: #000000;
>   padding: 1px 3px;
> }
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

unfortunately your css suggestions don't keep the line numbers from coming
across when copying the code sample.  that's the current showstopper.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> This only works if the PRE text does _not_ include
> entities. Depending on how you set up this text this
> may be preferable - or may be a stopper.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

actually entities seem to work.  the trick is to convert them from entities
back to their resulting character just before passing the string as the
argument of the createTextNode() method.  that's because that method
apparently converts entities automatically.  annoyingly it doesn't convert
multiple spaces into &nbsp; though and trying to do that conversion ahead of
time results in a string with &amp;nbsp; strings in it (even more annoying).

so, these two things are what i would consider showstoppers for nn6/moz.

got any other ideas?

thanks,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/





More information about the thelist mailing list