reveal_external icon indicating copy to clipboard operation
reveal_external copied to clipboard

TypeError: container.querySelectorAll is not a function

Open SirkoS opened this issue 4 years ago • 0 comments

I get the above error when I try to run the plugin even with a minimal setup like this

index.htm

<section data-external="slides/01-motivation.htm"></section>

slides/01-motivation.htm

<h3>What's the problem?</h3>
<div>
  <img src="./../gfx/someImage.jpg" />
</div>

The same effect happens using data-external-replace and an included file like this (with a trailing line break, that somewhat is cut by github):

<section>
  <h3>What's the problem?</h3>
  <div>
    <img src="./../gfx/someImage.jpg" />
  </div>
</section>

The full stack trace looks like this

Uncaught TypeError: container.querySelectorAll is not a function
    convertAttributes [...]/node_modules/reveal_external/external/external.js:72
    convertUrls [...]/node_modules/reveal_external/external/external.js:89
    onreadystatechange [...]/node_modules/reveal_external/external/external.js:123
    updateSection [...]/node_modules/reveal_external/external/external.js:155
    loadExternal [...]/node_modules/reveal_external/external/external.js:188
    <anonymous> [...]/node_modules/reveal_external/external/external.js:194
    <anonymous> [...]/node_modules/reveal_external/external/external.js:195

I checked the code and it seems the issue is caused by text-nodes being passed to convertUrls(). A quick fix would be to change line 122 to the following:

if( nodes[i] instanceof HTMLElement ) {
  convertUrls( nodes[i], path );
}

SirkoS avatar Feb 02 '21 14:02 SirkoS