Re: Finding line numbers of HTML elements



Bart Van der Donck wrote:
Michael Winter schreef:
On 19/08/2006 14:01, Bart Van der Donck wrote:
If this is true then the FAQ is wrong, since the routine
comes straight from http://www.jibbering.com/faq/#FAQ4_38.

No, /your application/ of code obtained from a resource
/referenced/ by the FAQ is wrong.

What would be this "correct application" of that code then ?

There could be no single 'this "correct application" of that code', and
a comprehensive list of 'correct applications' would be an unrealistic
expectation (not least because of the subjectivity in the assessment of
correctness, but mostly because the context of application significantly
modifies the 'correct' strategy of use). However, there will not be many
contexts in which a script erroring-out at runtime would be considered
correct (intrinsic event handlers where failure in the event handler
directly results in page replacement (as a style of clean degradation)
may be the only possible exception, though I still would not encourage
the possibility of the user being shown an error message).

Nowhere did Jim write that the xmlhttp variable shouldn't be
checked.

A little common sense, please.

Most appeals to "common sense" are made in support of bad ideas. (I am
often reminded of William Edgell's appeal to "common sense" in his 1927
defence of the idea of a flat Earth (<URL:
http://www.litotes.demon.co.uk/\dTeR/doesTheEarthRotate.html >).)

Why doesn't he just check it then in the code ?

Is the subject of the page the behaviour of the XML HTTP request object
or is it general script design?

However, if the page did include specific examples of 'safe' employment
of the object those examples may be take as representing a definitive
strategy. In such small examples the tendency would be to wrap the test
around the code that actually used the object, while the bigger picture
may suggest some form of 'gateway' testing during page initialisation,
or a 'test on first use only' or 'Russian Doll' style of implementation,
particularly if multiple requests were to be expected on the same page.

Without a genuine context examples that do test for the availability of
features tend to test too far into the code (at the point where the
features is employed) and propose superficial and stupid responses to
failures (such as popping up some sort of "your browser does not support
this script" message). These examples get carried through to actual web
pages unaltered with sufficient frequency as to demonstrate that that
type of example can be as much of a hindrance to learning as an aid. In
practice designing for clean-degradation in response to negative results
from feature testing is so intimately linked to the context in which a
script is used that demonstrations of a single test and response
strategy are insufficient (even misleading).

Richard.


.



Relevant Pages

  • Re: window.onerror for chrome
    ... "Allow script to detect context menu events" option is off. ... developers allow for these features to be disabled. ... Last I saw on the w3c's feature detection proposals, ...
    (comp.lang.javascript)
  • Re: Turing Machines and Physical Computation
    ... citing once again (although without their original context for reasons ... controls ate all pellets delivered. ... Stemmer and some other psychologists treat under the ... response to one stimulation and penalized for the same ...
    (comp.theory)
  • Re: Turing Machines and Physical Computation
    ... citing once again (although without their original context for reasons ... controls ate all pellets delivered. ... Stemmer and some other psychologists treat under the ... response to one stimulation and penalized for the same ...
    (sci.math)
  • Re: Turing Machines and Physical Computation
    ... >> take their emotional responses as something to further act upon. ... I have commented on what i got from each in this context. ... >> response to one stimulation and penalized for the same ... >> free to internalize in his peculiar neural way. ...
    (comp.theory)
  • Re: Turing Machines and Physical Computation
    ... >> take their emotional responses as something to further act upon. ... I have commented on what i got from each in this context. ... >> response to one stimulation and penalized for the same ... >> free to internalize in his peculiar neural way. ...
    (sci.math)