Javacrap, i mean javascript

a bit OT but,

you see i’m writing a web app. now in writing a complex web app one of course
requires some dynamic content. the curse to man that the only option for this
is javascript! --undoubtedly the worst language ever invented by man! i have
now spent the last three hours trying to do one thing: change the text in a
table cell. how god aweful! worse is that i am actually pretty expierenced
with this mess of syntax that i now calling javacrap.

this is essentially my table cell:

<td>Text<input type="hidden" name="aname" value="Text"></td>

thus the problem: i can change what’s in

with .innerHTML but then i
overwrite the tag as well. but it is important that the input tag is
there b/c that’s how i locate the table cell (document.form.aname.parentNode)
can’t find a better solution (innerText is seems only work with IE) than to
write a little string disector that will pull off the input tag and add it
back in. frigi’n sick.

the bottom line is quite simple: javascript and DOM SUCK THE BIG ONE. i would
say that over 50% of my dev time actually goes into dealing with these little
javacrap issues.

so why are there not alternatives to this mess? where’s RubyScript with an
REXML like interface to the underlying content? where? we have a gazillion
alternatives for server-side scripting, but One for client-side. what’s wrong
with this picture?

anyway, anyone have a better solution. i really don’t want to hack it like
i’ve suggested, although is prob a clever what to do it with regexp
substitution (well, maybe, let me check this 800 pound manual)

-transami

a bit OT but,

this is essentially my table cell:

Text

document.forms[0].elements[“aname”].value = “text2”

if first (or only) form on page, or if named form:

document.forms[“fname”].elements[“aname”].value = “text2”

Re the non-input text, try laying ti out this way:

Text

Now:

if (document.all) document.all.atext.innerTEXT = “text2”
else document.getElementById(“atext”).innerHTML = “text2”

the bottom line is quite simple: javascript and DOM SUCK THE BIG ONE.

Well, I wouldn’t say that exactly. What "SUCK"s is the non-standard
proprietary implementations IMO; but it does appear to be getting
better.

so why are there not alternatives to this mess? where’s RubyScript with an
REXML like interface to the underlying content? where? we have a gazillion
alternatives for server-side scripting, but One for client-side. what’s wrong
with this picture?

Well, I would like to see this as well. Unfortunately, I have very
little influence with the Mozilla project and aboslutely none with
Redmond. With regard to the former, though, soemone clever could
implement a browser using “RubyScript” as an alternative to or
replacement for JavaScript. But that is just the beginning; this super
Rubified browser would have to gain sufficient market share to warrant
site developers writing to it, and that is a long hard road.

anyway, anyone have a better solution. i really don’t want to hack it like
i’ve suggested, although is prob a clever what to do it with regexp
substitution (well, maybe, let me check this 800 pound manual)

Hope some of my suggestions help.

Regards,

Kent Starr

···

On Wed, 2003-01-01 at 21:25, Tom Sawyer wrote:

Text

thanks, i realized i would have to resort to something like this soon after i
wrote my email. the difficulty is with subrecords, i.e where i have an array
of records to put up. with the form elements the names can be the same and
thus end up in an array. but

don’t do that. so i have use index
numbers in the id, i.e.
to identify each one individually.

Well, I would like to see this as well. Unfortunately, I have very
little influence with the Mozilla project and aboslutely none with
Redmond. With regard to the former, though, soemone clever could
implement a browser using “RubyScript” as an alternative to or
replacement for JavaScript. But that is just the beginning; this super
Rubified browser would have to gain sufficient market share to warrant
site developers writing to it, and that is a long hard road.

perhaps its time to move to the next level. not try to strong arm anyone into
supporting rubyScript in the browser, etc, etc. the future i think is in
making a new browser, with better markup then HTML and easily plugable
client-side scripting (a la GIMP), and not dumbing down the power. imagine
how great it would be if we had Ruby on the client side and server side
talking dynamically and throwing up new fangled markup on the fly. now that
would be sweet. HTML is getting so old hat. thus the likes of Flash, but
Macromedia in there super wisdom created ActionScript (Javacrap++).

anyway, anyone have a better solution. i really don’t want to hack it
like i’ve suggested, although is prob a clever what to do it with regexp
substitution (well, maybe, let me check this 800 pound manual)

Hope some of my suggestions help.

yep, thanks Kent.

=tranasmi

···

On Wednesday 01 January 2003 08:28 pm, W. Kent Starr wrote:

W. Kent Starr wrote:

if (document.all) document.all.atext.innerTEXT = “text2”
else document.getElementById(“atext”).innerHTML = “text2”

W3C DOM has no innerHTML as far as I understand, it is MS invention used
only in their standard, so it should be:
document.getElementById(“atext”).value=“text2”

the if/else hack is needed only to support browsers of IE <= 4.0, as IE
5.0 supports at least the basic parts of W3C DOM.

Idan.

W. Kent Starr wrote:

if (document.all) document.all.atext.innerTEXT = “text2”
else document.getElementById(“atext”).innerHTML = “text2”

W3C DOM has no innerHTML as far as I understand, it is MS invention used
only in their standard, so it should be:
document.getElementById(“atext”).value=“text2”

yes, i read that in my javacrap tomb, but it don’t work in mozilla, innerHTML
does.

don’t ask me! i think someone ought to be shot for all this. but my guess is
that their singing whoever it is praises daily over there as M$.

the if/else hack is needed only to support browsers of IE <= 4.0, as IE
5.0 supports at least the basic parts of W3C DOM.

well, i’m only after the more recent versions. so i’m hoping innerHTML serves
me well on other browsers too.

-transami

···

On Thursday 02 January 2003 01:31 am, Idan Sofer wrote:

Oh, you mean like Mozilla’s GRE (Gecko Runtime Environment) and Ruby
XPCom bindings (http://rbxpcom.mozdev.org) for writing cross-platform
apps you can serve over the web. :slight_smile: :slight_smile:

···

Tom Sawyer (transami@transami.net) wrote:

perhaps its time to move to the next level. not try to strong arm anyone into
supporting rubyScript in the browser, etc, etc. the future i think is in
making a new browser, with better markup then HTML and easily plugable
client-side scripting (a la GIMP), and not dumbing down the power. imagine
how great it would be if we had Ruby on the client side and server side
talking dynamically and throwing up new fangled markup on the fly. now that
would be sweet. HTML is getting so old hat. thus the likes of Flash, but
Macromedia in there super wisdom created ActionScript (Javacrap++).


Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Tom Sawyer wrote:

W3C DOM has no innerHTML as far as I understand, it is MS invention used
only in their standard, so it should be:
document.getElementById(“atext”).value=“text2”

yes, i read that in my javacrap tomb, but it don’t work in mozilla, innerHTML
does.

Mozilla has a compatiblity layer to IE DOM, However, It works well
mostly as long as it’s pure IE DOM, I have encountered cases where
mixing IE and W3C DOM can have odd results.

In anycase Mozilla has one of the most complete implementation of DOM
L1/L2 and CSS2, better then IE at least.

You might wish to try Mozilla’s JavaScript deugger, it is really useful
tool IMHO.

Idan

···

On Thursday 02 January 2003 01:31 am, Idan Sofer wrote:

Actually, Javascript is a pretty cool language. It has many OO features
that would make it nice to use in some projects, although they are not
that useful for your typical run-in-a-browser script. The problem is not
the language, it is DOM, which is actually separate from the language and
all those bloody different implementations in different browsers that
don’t work the same. All that cross-browser tag you have to play when
writing javascript apps make it really, really painful. I feel you, I hate
writing anything in Javascript. Just wanted to note where the problem
actually lies.

···

On Thu, 2 Jan 2003 19:13:13 +0900 Tom Sawyer transami@transami.net wrote:

On Thursday 02 January 2003 01:31 am, Idan Sofer wrote:

W. Kent Starr wrote:

if (document.all) document.all.atext.innerTEXT = “text2”
else document.getElementById(“atext”).innerHTML = “text2”

W3C DOM has no innerHTML as far as I understand, it is MS invention
used only in their standard, so it should be:
document.getElementById(“atext”).value=“text2”

yes, i read that in my javacrap tomb, but it don’t work in mozilla,
innerHTML does.

don’t ask me! i think someone ought to be shot for all this. but my
guess is that their singing whoever it is praises daily over there as
M$.

the if/else hack is needed only to support browsers of IE <= 4.0, as
IE 5.0 supports at least the basic parts of W3C DOM.

well, i’m only after the more recent versions. so i’m hoping innerHTML
serves me well on other browsers too.

-transami


“Daniel P. Zepeda” <daniel@z,e,p,e,d,a,-,z,o,n,e.net>
(Remove commas for address)

true true. javascript still pales to ruby, but, yes, the DOM is really the
heart of the bad matter.

···

On Thursday 02 January 2003 04:37 am, Daniel P. Zepeda wrote:

Actually, Javascript is a pretty cool language. It has many OO features
that would make it nice to use in some projects, although they are not
that useful for your typical run-in-a-browser script. The problem is not
the language, it is DOM, which is actually separate from the language and
all those bloody different implementations in different browsers that
don’t work the same. All that cross-browser tag you have to play when
writing javascript apps make it really, really painful. I feel you, I hate
writing anything in Javascript. Just wanted to note where the problem
actually lies.