Re: Build web apps in Javascript - new service open for beta



On Feb 21, 6:14 am, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
David Mark said the following on 2/21/2008 4:31 AM:

On Feb 21, 4:19 am, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
David Mark said the following on 2/21/2008 3:00 AM:

On Feb 21, 12:19 am, AppPad <sav74...@xxxxxxxxx> wrote:
<snip>

will take a bit more research on the best way to do it.
Not really.
window.onload = myfunction;
Don't let Thomas know that :)

Proprietary and error-prone approach.  I know.

Only in Thomas' warped mind is it.

Agreed.


BTW, based on a recent post of yours, I take it that you now consider
this inferior to an onload attribute in the body tag.  

No. I don't. You are using the onload event of two entirely different
objects. One is the body element, the other is the window.

However, in some browsers they amount to the same thing. For example,
setting window.onload cancels out the listener created in the body's
onload attribute.


Something about unobtrusive JS being a joke.  

In the context and post that I made that statement, it was a script that
was attempting to add an event handler to a single element. There are
three reasons I can think of, easily, for doing it that way:

1) An exercise in trying to dynamically add event handlers.
2) Lack of knowing better.
3) The guise of "unobtrusive javascript".

If you are adding multiple, duplicated, event handlers, then by all
means do it by script. Make it simpler on yourself. Then put the JS code
in an external file so that non script UA's don't have to download a lot
of code it will never use.

Right. It makes maintenance easier and is a more flexible structure
as well.


When people take it too far then it becomes a joke to me. I find it
humorous in a strange kind of way. Dynamically adding an event handler
to a single element instead of just coding it? Yeah, it is humorous to me.

I don't know. I don't like to mix script in with the markup.


Granted, it is a fairly ambiguous term and the techniques associated
with it are often misused, but I fail to see the humor in it.

It didn't help matters for me to have my weekly Monday meeting at work,
leave, open up my Intranet site Wednesday morning last week, encounter
error messages. Right Click>View Source, lets find the problem. What I
found was these two lines:

<script type="text/javascript" src="prototype-1.6.0.2"></script>
<script type="text/javascript" src="jquery-1.2.3"></script>

As Thomas would say: OMG.


A call to one of my senior programmers let me know they had spent the
afternoon Monday and all day Tuesday re-doing my Intranet so that it
would be "Unobtrusive Javascript to get the scripts out of the HTML
file" and the only way to do that was to "use jQuery and Prototype". No,

LOL. Where did you find this "senior programmer?" A soup kitchen?

it didn't put me in a good frame of mind about unobtrusive javascript.

Certainly unobtrusive JavaScript via Prototype *and* jQuery is
madness. Your "senior programmer" should be demoted to junior
janitor.


The other "defense" of it is to have "clean HTML". And that is also
humorous to me. People doing things that are good but they don't even
have the first clue *why* they are doing it that makes it unobtrusive.

That's the way of the Web currently.


And, no, he doesn't work for me anymore.


I imagine not. Clean HTML indeed. Simply add 200K of incompetent
script and just look at the difference!

One can only wonder where this "senior programmer" got his
information. Clearly he doesn't read this group.
.



Relevant Pages

  • Re: "modern" javascript...
    ... Looking in the source to edit jspf, include, and tag files, or PHP ... As I said before, the event handler attribute ... True if the `script' element is the child of the `head' element. ... ISTM the example showed your idea of a "bottom script" quite well. ...
    (comp.lang.javascript)
  • Re: Causing File Download on Page Load
    ... Script code in the document head or body is executed while the document is ... So script in the onload handler executes after the document is finished loading? ... and not using a wrapper. ...
    (comp.lang.javascript)
  • Re: Cross-Browser Mouse Event Handling
    ... The approach of assigning an event handler via script separates ... Which browser does an external script block scrolling? ... Executing a script does freeze the UI, ...
    (comp.lang.javascript)
  • Re: "modern" javascript...
    ... HTML would only have one element ... event handler for the element's onchange event, ... the HTML, not in the js file, the script is more scattered. ... apparent value of "maintainability" etc. ...
    (comp.lang.javascript)
  • Re: Cross-Browser Mouse Event Handling
    ... But don't event handler attributes have their own problems ... the attachment from from the content, so the script can be moved ... imported by a web page rather than intrinsic event functions. ... Which browser does an external script block scrolling? ...
    (comp.lang.javascript)