There seems to be an issue with the dom:complete event for IE in
Prototype 1.6. It seems that if you modify the document as its
loading, the dom:complete event on the document fires too early -
before it has the entire contents of the page.
I have some script that runs in the page and modifies the contents,
and other script that runs on dom:complete to hook up event handlers
to elements. In IE I regularly get an incomplete set of elements
because the page has not yet fully been parsed.
So this code returns all 6 paragraphs for Firefox, but (usually) only
3 for IE:
<html>
<head>
<script type="text/javascript"
src="/js/libs/prototype.js"></
script>
<script type="text/javascript">
Element.observe(document, ''dom:loaded'', function(){
alert($$("p").length);
});
</script>
</head>
<body>
<p>paragraph</p>
<p>paragraph</p>
<p id="third">paragraph</p>
<script>
$("third").update("foo!");
</script>
<p>paragraph</p>
<p>paragraph</p>
<p>paragraph</p>
</body>
</html>
Note that its not always wrong - if you hit refresh IE will sometimes
return with the correct count of six. Typing into the location bar or
just hitting return again in the location field will usually cause it
to return the wrong count again.
Anyone else observe this issue? This makes it difficult to use the
dom:loaded behavior at all, unless you know nothing in the page is
going to attempt to modify the page as it loads.
Sample here : http://www.vamp.org/test/test.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Have you ever encountered the "Operation Aborted" error? IE tends to do strange stuff sometimes when you manipulate the dom oncontentready. AFAIK, it''s a completely random thing :-\ http://clientside.cnet.com/code-snippets/manipulating-the-dom/ie-and-operation-aborted/ You could try moving all your javascripts to the bottom of the page so all the paragraphs *will* have loaded by the time browsers parse the script, independent of page events. (Doing this also brings some other performance benefits: http://developer.yahoo.com/performance/rules.html#js_bottom) Best, -Nicolas On Dec 10, 2007 5:49 PM, Ryan Watkins <rwatkins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > There seems to be an issue with the dom:complete event for IE in > Prototype 1.6. It seems that if you modify the document as its > loading, the dom:complete event on the document fires too early - > before it has the entire contents of the page. > > I have some script that runs in the page and modifies the contents, > and other script that runs on dom:complete to hook up event handlers > to elements. In IE I regularly get an incomplete set of elements > because the page has not yet fully been parsed. > > So this code returns all 6 paragraphs for Firefox, but (usually) only > 3 for IE: > > <html> > <head> > <script type="text/javascript" src="/js/libs/prototype.js"></ > script> > <script type="text/javascript"> > Element.observe(document, ''dom:loaded'', function(){ > alert($$("p").length); > }); > </script> > </head> > <body> > > <p>paragraph</p> > <p>paragraph</p> > <p id="third">paragraph</p> > > <script> > $("third").update("foo!"); > </script> > > <p>paragraph</p> > <p>paragraph</p> > <p>paragraph</p> > > </body> > </html> > > > Note that its not always wrong - if you hit refresh IE will sometimes > return with the correct count of six. Typing into the location bar or > just hitting return again in the location field will usually cause it > to return the wrong count again. > > Anyone else observe this issue? This makes it difficult to use the > dom:loaded behavior at all, unless you know nothing in the page is > going to attempt to modify the page as it loads. > > Sample here : http://www.vamp.org/test/test.html > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve not run into the "Operation Aborted" error myself,
atleast that
I''ve noticed.
I dont normally use the oncontentready event directly, I''ve been using
a version of the LowPro Event.onReady until version 1.6 of prototype.
I could move the JS to the bottom, but the above is a contrived
example - for the site I''m working on I would like to execute some of
the JS as the page is loaded to get some UI elements functional before
the page is fully parsed.
After taking a closer look, one possibility may be to use the jquery
version 1.2.2 ready() method instead - it essentially does polling of
document.documentElement.doScroll("left") for IE.
On Dec 10, 4:38 pm, "Nicolás Sanguinetti"
<godf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Have you ever encountered the "Operation Aborted" error? IE tends
to
> do strange stuff sometimes when you manipulate the dom oncontentready.
> AFAIK, it''s a completely random thing :-\
>
> http://clientside.cnet.com/code-snippets/manipulating-the-dom/ie-and-...
>
> You could try moving all your javascripts to the bottom of the page so
> all the paragraphs *will* have loaded by the time browsers parse the
> script, independent of page events. (Doing this also brings some other
> performance
benefits:http://developer.yahoo.com/performance/rules.html#js_bottom)
>
> Best,
> -Nicolas
>
> On Dec 10, 2007 5:49 PM, Ryan Watkins
<rwatk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > There seems to be an issue with the dom:complete event for IE in
> > Prototype 1.6. It seems that if you modify the document as its
> > loading, the dom:complete event on the document fires too early -
> > before it has the entire contents of the page.
>
> > I have some script that runs in the page and modifies the contents,
> > and other script that runs on dom:complete to hook up event handlers
> > to elements. In IE I regularly get an incomplete set of elements
> > because the page has not yet fully been parsed.
>
> > So this code returns all 6 paragraphs for Firefox, but (usually) only
> > 3 for IE:
>
> > <html>
> > <head>
> > <script type="text/javascript"
src="/js/libs/prototype.js"></
> > script>
> > <script type="text/javascript">
> > Element.observe(document, ''dom:loaded'',
function(){
> > alert($$("p").length);
> > });
> > </script>
> > </head>
> > <body>
>
> > <p>paragraph</p>
> > <p>paragraph</p>
> > <p id="third">paragraph</p>
>
> > <script>
> > $("third").update("foo!");
> > </script>
>
> > <p>paragraph</p>
> > <p>paragraph</p>
> > <p>paragraph</p>
>
> > </body>
> > </html>
>
> > Note that its not always wrong - if you hit refresh IE will sometimes
> > return with the correct count of six. Typing into the location bar or
> > just hitting return again in the location field will usually cause it
> > to return the wrong count again.
>
> > Anyone else observe this issue? This makes it difficult to use the
> > dom:loaded behavior at all, unless you know nothing in the page is
> > going to attempt to modify the page as it loads.
>
> > Sample here :http://www.vamp.org/test/test.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---