Re: RFC: Building the Perfect Tabbed Pane (an tutorial article)



On Feb 13, 3:32 am, David Mark <dmark.cins...@xxxxxxxxx> wrote:
On Feb 13, 3:40 am, Peter Michaux <petermich...@xxxxxxxxx> wrote:

David Mark wrote:
On Feb 12, 10:26 pm, Peter Michaux <petermich...@xxxxxxxxx> wrote:

[snip]

If execution has reached this stage, then doc.createElement should be
tested to work. I have a feature test at the top for the existence of
document.createElement. I could add a test there that it also works
and a comment that it may be overly paranoid. I'm not being that
paranoid in other cases. I'd like the article to point out that you
can actually test things work as well as just testing they exist so
this may make a good example.

By habit, I have always tested the return value of createElement. It
may not be necessary. My original thinking was along the lines of a
browser that is out of resources and cannot create a new element.
Perhaps it would return null in that case (or perhaps it would just
blow up.)

That is overly paranoid! ;-)

I suppose the test could go with the cssDisplaySupport, because if the
browser has decided this late in the game that it isn't going to make
any more elements then that time for the check is before any elements
for the tabbed pane are created.

There are quite a few kinds of widgets that, when passed the point of
no return, require successful createElement calls to be successful.
There is almost no point in testing the calls worked at that late
stage in the game. I suppose an attempt to back out of the widget to
the static version could be made. An error message saying "you
computer has very little memory...upgrade." might help.

[snip]

Better to add the needed rules via DOM
manipulation. Of course, that logic must reside in a script block
outside of the head element, else you risk the dreaded "Operation
Aborted" error in IE.

Officially, the DOM is supposed to be read only until window.onload. I

According to whom?

The only reference I can find right now is

<URL: http://www.devguru.com/technologies/xmldom/quickref/document_readyState.html>

I don't see anything on the Microsoft site about the DOM being read-
only in this state. I may just be wrong about this.


Personally, I don't touch the body element until
the document has completed parsing, but adding style elements to the
head shouldn't be an issue as long as the script is after the closing
head tag.

don't want to touch it in any way. I like following the rules. I'm
sure the people that started seeing that Operation Aborted error
didn't know what to do for a long time and the only reason they saw it
was because they didn't follow the rules.

No, it is a documented bug in IE6. I don't know if it exists in IE7
or not.

I believe IE7 does have it and that I've seen it. That was quite a
while ago so my memory may be wrong.


I've never run into it, except when testing third-party
scripts. It is caused by attempting to manipulate elements that
haven't been fully parsed.



The only sanctioned thing that can be done while the page is loading
is document.write to dynamically generate parts of the page.

I've never heard of such a rule and certainly nobody conforms to it
(or enforces it.) What would be the point of DOMContentLoaded if you
had to wait for the load event?

I always figured that DOMContentLoaded was a proprietary extension
that was early permission to the developer that even though the
standard says to wait, it is actually ok to start manipulating now. It
looks like I was wrong about the read-only part, however.

Peter
.



Relevant Pages

  • Re: all script functions
    ... <HTML> ... <HEAD> ... Why do you need to get the text of the script if it is your own script ...
    (microsoft.public.scripting.jscript)
  • Re: Obesity blackspot towns revealed - Discrimination Against Fat Northern Bastards??
    ... >I can show you much cheaper property than that....very much cheaper. ... Mind you she was not studiously developing a fat northern arse courtesy of copious volumes of 'Pie & Chips' and ale. ... occurrence of pain it would be wise to desist in the banging of my head ...
    (uk.politics.misc)
  • Re: What to do about Islam?
    ... Be sure to read the section "Henson versus Scientology" ... I don't think anyone has their head in the sand anymore. ...
    (rec.org.mensa)
  • Re: OT. Freedom Of Speech
    ... Our playing field was a 4-mile bus ride away. ... I've not looked at cycling helmet effectiveness. ... head injury - but it'll also improve the chances of yer neck snapping, ...
    (uk.people.support.depression)
  • Re: Javascript: string detection
    ... this script doesn' work, probably, because of the wrong syntax. ... A complete syntax check is better left to the server where existing code is more readily available and not a burden on the client. ... Be aware that even the regular expression above is restrictive as it won't accept literal IPv6 addresses, those that contain display names, or comments in some locations. ...
    (comp.lang.javascript)