Re: Automatic line numbering on PRE elements - Solved, sort of



RobG wrote:
Wayne wrote:
Anthony Levensalor wrote:
Wayne said:
[snip]
Would it be reasonable to post the code here, and have
some of you experts fix it up so it works in all
browsers?

I expect that something like this is much better done on the server -
use a suitably styled ol element and you should be able to overcome most
browser differences.

Doing this on the client just doesn't make sense.

I would agree, I am also working on a PHP app for a source code
viewer. Then I could use an iframe or something similar to include
the listings in other documents. I am also playing with OpenGrok
and other code lister apps for this. Such an approach also allows
one to HTML-encode the text.

But not all PRE elements that I want numbered contain program
code. And I have hundreds of pages already that use PRE, and could
easily be changed to add a class="numbered" attribute to the tag.

I *could* just say this is for an AJAX app, that seems to be an excuse
to do anything on the client! :-) But a better reason is that
I expect CSS 3 to include the '::line-marker' pseudo selector, allowing
an easy way to number my PRE tags. So it does make sense, even if not
a lot, to use JavaScript for this, for now.

I am still learning JavaScript (and have been, on and off, for 10 years).
Mastering a new technique like correctly numbering lines is also a
way to sharpen my coder skills.

-Wayne
.



Relevant Pages

  • Re: RFD: How To Recognize Bad Javascript Code
    ... Elements consist of tags ... Your example `script' elements are empty where they should have ... | it cannot provide a fallback to browsers not running Javascript. ... Some web developers use this to work ...
    (comp.lang.javascript)
  • Making browsers behave the same
    ... Following T i m's rather plaintive assertion that there is no excuse for all browsers not behaving identically, I put some effort into making my app work under Firefox. ... FF seems to have some different defaults than Safari, but by adding a tiny amount of css here and there this was overcome. ...
    (uk.comp.sys.mac)
  • Re: web page communicating with an applet
    ... set group of browsers, and have control over ... browsers it is supported on, ... Had you considered breaking up the app. ... Also - webstart has a 'lazy download' ...
    (comp.lang.java.programmer)
  • Re: IE6 quirks
    ... My app looks right in IE7 ... Did you include browsers without JavaScript in your testing? ... Everything gets crammed up against the top and IE6 does not respect the ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Background sound for IE and FF
    ... >> I placed following code in a page to play background sound on IE and FF ... > The bgsound tag is an IEthing only, ... > but at some point Microsoft added embed support for their browsers, ...
    (alt.html)

Loading