Hi. I'm running IMCE version 7.x-1.7 with IMCE Wysiwyg API bridge version 7.x-1.0. The bug I've outlined below also happens in IMCE version 7.x-1.5

When the file browser window launches everything loads as expected. However when I click on a folder I get the following error:

Uncaught TypeError: Cannot set property 'innerHTML' of null

The code is line 514 of imce.js:

imce.el('file-preview').innerHTML = html;

Using the developer tools in Chrome, Firefox or IE when I look at the markup for the page the preview-wrapper div is empty (the code below is from Chrome).

<div id="preview-wrapper" style="height: 285px;"></div>

However, if I use "view source" from either browser's context menu I see clearly that the file-preview div is there (the code below is also from Chrome):

<div id="preview-wrapper"><div id="file-preview"></div></div>

Using the JS console if I use document.getElementById to test the preview-wrapper object it returns as expected:

[object HTMLDivElement]

However, if I try to access the file-preview object using document.getElementById it returns null.

This results in the anything beyond the first click in the IMCE window doesn't work, since the uncaught exception is thrown and halts anything following it. The preview of images also fails because of this bug.

In imce-content.tpl.php the file-preview div can clearly be seen, though it is empty.

<div id="preview-wrapper"><div id="file-preview"></div></div>

The bug is somehow related to the fact that the div is empty. If I add a non-breaking space the problem is resolved.



ufku’s picture

Status: Active » Closed (cannot reproduce)

This is probably specific to your system(browser, os, etc.). You are on your own to identify what is causing the empty elements being removed.