Re: Finding line numbers of HTML elements
- From: "Richard Cornford" <Richard@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 19 Aug 2006 16:44:18 +0100
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.
.
- References:
- Finding line numbers of HTML elements
- From: e271828
- Re: Finding line numbers of HTML elements
- From: Randy Webb
- Re: Finding line numbers of HTML elements
- From: e271828
- Re: Finding line numbers of HTML elements
- From: e271828
- Re: Finding line numbers of HTML elements
- From: e271828
- Re: Finding line numbers of HTML elements
- From: Bart Van der Donck
- Re: Finding line numbers of HTML elements
- From: Richard Cornford
- Re: Finding line numbers of HTML elements
- From: Bart Van der Donck
- Re: Finding line numbers of HTML elements
- From: Michael Winter
- Re: Finding line numbers of HTML elements
- From: Bart Van der Donck
- Finding line numbers of HTML elements
- Prev by Date: Re: JavaScript associative arrays not ordered?
- Next by Date: Re: InternetExplorer fireEvent, keyEvent (onscreen JScript keyboard)
- Previous by thread: Re: Finding line numbers of HTML elements
- Next by thread: Re: Finding line numbers of HTML elements
- Index(es):
Relevant Pages
|