Hi,

> > Why not using DOM? [...]
>
> It was just a suggestion on how the code could be improved (and a good
> chance to work on my RegExp skills).

That is OK, but in production code I see no point in reeimplementing stuff 
that you already have with DOM. It is fine while praticing.

> Plus it involves a lot less code. 

If you strip out all the code for the various other ticker-variants and 
convert the rest to use jQuery, I don't expect the difference to bee too big. 
You can also reduce the API of my code (no start()-function, but immediate 
start, have no stop()-function - simply never stop, have no way to 
changeSpeed()-function, etc. You don't have that in your implementation. To 
have a fair comparison you would need to add that (or remove it from mine).

> I would have thought performance may be a bit better (but probably not
> that noticeable) due to using innerHTML rather than DOM manipulation.

Well, on the other hand you try to parse the HTML where I simply use the 
existing DOM.

There is also a big difference in the result. Imagine this code:

<div id="typewriter">
<h1>asdf asdf asdf</h1>
<p style="background-color:yellow">
asdf asdf asdf asdf asdf asdf asdf asdf asdf
</p>
</div>

Your code may generate

<h1>asdf asdf asdf</h1>
<span style="visibility:hidden"><p style="backgrou</span>

as inner HTML. There are two issues with this: 1. the '<' before p is no clean 
XHTML and 2. you are waiting for the typewriter to go through 35 steps before 
the content of the p is written out.

There is another issue with your code. You take the content for your 
typewriter from a parameter to your function, where I take the contents of 
the element that should be the container. With my code people who have JS 
switched off can read the content - they just miss the fancy typewriter.

Christof

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to