One more good reason to use DOM Ready :) IMO It's not worth it to add overhead - and traversing up to the body is an expensive operation - to the append functions because of a single browser issue that's quite well known. Also, hopefully IE6's death is around the corner.
cheers, - ricardo On Apr 6, 11:13 am, ajp <[email protected]> wrote: > Trying to do manipulate an element from within it can cause an error > in IE6. So this WONT work in IE6 > > <!DOCTYPE html> > <script src="jquery.js"></script> > <div> > <p>foo</p> > <script> > $('div').append('bar'); > </script> > </div> > > ... but will in IE7 and 8. So 7 and 8 look more forgiving, but unlike > other major browsers if you try to manipulate the body before it's > closed, that won't work either. So this won't work in any version of > IE: > > <!DOCTYPE html> > <script src="jquery.js"></script> > <body> > <p>foo</p> > <script> > $(document.body).append('bar'); > </script> > </body> > > I'm inclined to think 'fair enough' - the error message is quite > descriptive ("Unable to modify the parent container before the child > element is closed"), and the fix is quite easy: either move the script > or do it properly with a $(document).ready call. > > However (and this is the problem): in either scenario IE6 has a > complete tizz, tells you it's aborting, blanks the page and then > claims you have 'network connectivity problems'. > > It's not so much a jquery issue, but a fix might be to check that the > script is not a child of the element that's being modified. It's > probably not worth solving, but I leave it here as reference because > IE6 gives no clue as to why it has gone a bit mad. > > AJP --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
