html5shiv icon indicating copy to clipboard operation
html5shiv copied to clipboard

ownerDocument.namespaces throws 'unspecified error' in IE8

Open juafrlo opened this issue 12 years ago • 2 comments
trafficstars

I'm using html5shiv in a project, and I have random errors here:

function shivPrint(ownerDocument) { var shivedSheet, wrappers, data = getExpandoData(ownerDocument), namespaces = ownerDocument.namespaces, ------> Here I got an error ownerWindow = ownerDocument.parentWindow; ....

This function is called from: shivPrint(document);

The javascript console throws this info about the error: 'unspecified error' in line...

It seems the ownerDocument (the document) is not set or initialized correctly at this point, and it happens only sometimes. To avoid this error, I wait to window.onload event to call this function.

// Wait for onload to avoid load document error in IE8 window.onload = function() { // shiv for print shivPrint(document); }

juafrlo avatar Feb 26 '13 09:02 juafrlo

@juafrlo

Thanks for your bugreport. I will look into this soon. The onload event might be to late. We could try to use a IE-only domcontentready method. Additionally window.onload = your function, can be overwritten or overwrites other event handler. It's not save.

aFarkas avatar Feb 27 '13 10:02 aFarkas

@juafrlo's fix worked for us - would be nice to get this fix formalized. (found this project and bug via modernizr)

rtgibbons avatar Jul 17 '13 03:07 rtgibbons