amplify.store and IE (unable to modify parent container)

119 views
Skip to first unread message

TS (Gentics)

unread,
Mar 20, 2011, 7:52:26 AM3/20/11
to Amplify
When loading amplify.store.js via a script element in the head, I get
the following error:
"
HTML Parsing Error: Unable to modify the parent container element
before the child element is closed (KB927917)
"

This error seems to be caused by the userData storage engine wanting
to append to the "html" element which has not finished parsing:
http://blogs.msdn.com/b/ie/archive/2008/04/23/what-happened-to-operation-aborted.aspx

The workaround I use is simply to load the script dynamically in $
(document).ready(...) which works fine.

Thanks for this great client side storage solution.

Scott González

unread,
Mar 21, 2011, 8:14:03 AM3/21/11
to ampl...@googlegroups.com
I'm not seeing any errors in IE and our tests include the script in the head: https://github.com/appendto/amplify/blob/master/store/test/test.html#L11

We intentionally attach to the html element to avoid this specific problem with the body element.

What version of IE are you using?

Tobias Steiner

unread,
Mar 21, 2011, 1:46:33 PM3/21/11
to ampl...@googlegroups.com
Hello Scott,

thanks for the reply.

I've used IE7 and IE8.

But, I now see that the current code in the repository is implemented differently from the minified files in the download package.

Curret implementation:
// append to html instead of body so we can do this from the head
var div = document.createElement( "div" ),
attrKey = "amplify",
attrs;
div.style.display = "none";
document.documentElement.appendChild( div );

Minified files in the download package:
// append to html instead of body so we can do this from the head
var div = $( "<div>" ).hide().appendTo( "html" )[ 0 ],
attrKey = "amplify",
attrs;

I think the earlier version in the download package causes the problem. It's not an issue to me any more, just wanted to let you know about a possible bug.

Thanks again.

Kind regards,
Tobias.

2011/3/21 Scott González <scott.g...@gmail.com>

Scott González

unread,
Mar 21, 2011, 1:56:23 PM3/21/11
to ampl...@googlegroups.com
Hey Tobias,

These two implementations should actually do the same thing. I also couldn't reproduce this with the 1.0a1 release. Haymo mentioned that this was seen in MultipleIE whereas I'm testing against actual IE installs.

Regardless, glad to hear that it's no longer a problem for you :-)

Tobias Steiner

unread,
Mar 22, 2011, 6:38:37 AM3/22/11
to ampl...@googlegroups.com
Hello Scott,

I've attached a sample file.
I tested it with the newest core and store files from the git master branch.
I've tested with IE8 (on a different system than the MultipleIE one).

With IE8 I get a blank page and an error indicator at the bottom-left corner of the browser. Double-clicking the error indicator shows the error in my original message.

Including the script dynamically solves the problem.

Kind regards,
Tobias.

2011/3/21 Scott González <scott.g...@gmail.com>
Hey Tobias,
amplify.html

Tobias Steiner

unread,
Mar 22, 2011, 6:40:33 AM3/22/11
to ampl...@googlegroups.com
Hallo Scott,

googlemail stripped the script headers, so here the sample again as zip file.
amplify.zip

Scott González

unread,
Mar 22, 2011, 8:30:50 AM3/22/11
to ampl...@googlegroups.com
Using your test file with my unminified versions of jQuery 1.4.2, json2, amplify.core (from master) and amplify.store (from master), I didn't get any errors. Tested in IE 8.0.6001.18702 on Windows XP.

Tobias Steiner

unread,
Mar 23, 2011, 9:44:44 AM3/23/11
to ampl...@googlegroups.com
I was using IE 8.0.7600.16385 on windows 7 ultimate.

I get the same error in IE7 (Windwos XP), although it just says "Internet Explorer cannot open the Internet  site ... Operation Aborted".

I also get an error with the MultipleIE IE6.

I made a change to append the userData element to the head element instead of the document element, to test whether my orignal assumption, that the error was caused by appending to an element that has not finished parsing, is correct.

With the attached change, the test page amplify.html loads without errors in IE8, and input is remembered correctly. For me, this change would solve the problem permanently, without having to use the workaround of loadin the script dynamically.

I put the patch in the public domain.

Kind regards,
Tobias.

2011/3/22 Scott González <scott.g...@gmail.com>
0001-Fixes-blank-page-when-loading-amplify.store.js-in-IE.patch

Scott González

unread,
Mar 23, 2011, 9:58:33 AM3/23/11
to ampl...@googlegroups.com
Thanks Tobias. I'll verify the script and land the patch today or tomorrow.

Scott González

unread,
Mar 24, 2011, 10:57:40 AM3/24/11
to ampl...@googlegroups.com
I've verified that the test suite still passes in IE 6-9 with this patch applied. Landed in https://github.com/appendto/amplify/commit/576dbc25cbb77adbb5c9079cf629d1c2a24c142e. Thanks.


2011/3/23 Scott González <scott.g...@gmail.com>

Tobias Steiner

unread,
Mar 25, 2011, 5:11:11 AM3/25/11
to ampl...@googlegroups.com
Thanks again!

Kind regards,
Tobias.

2011/3/24 Scott González <scott.g...@gmail.com>
Reply all
Reply to author
Forward
0 new messages