Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: e.querySelectorAll is not a function #3524

Closed
leonalkalai opened this issue Nov 12, 2023 · 6 comments
Closed

Uncaught TypeError: e.querySelectorAll is not a function #3524

leonalkalai opened this issue Nov 12, 2023 · 6 comments

Comments

@leonalkalai
Copy link

"Uncaught TypeError: e.querySelectorAll is not a function" on console on reveal.js slider each time i try to use data-line-numbers attribute.

code1
code2
code3
code

<pre class="codestyle">
<code class="language-html" aria-hidden="true" data-line-numbers="2|4|6|8|10|12">
	<span>&#9193; &#9193; &#9193;    A</span>

	<span>&#9193; &#9193; &#9193;    Shift + Space</span>

	<span>&#9193; &#9193; &#9193;    Control + Alt + U + .</span>

	<span>&#9193; &#9193; &#9193;    Control + Shift + &#39;</span>

	<span>&#9193; &#9193; &#9193;    Alt+Shift+P Control+F</span>
	
	<span>&#9193; &#9193; &#9193;    Meta+C Meta+Shift+C</span>
</code>
</pre>

And i get error

highlight.min.js:1 Uncaught TypeError: e.querySelectorAll is not a function
    at Object.getHighlightedLineBounds (highlight.min.js:1:903503)
    at Object.scrollHighlightedLineIntoView (highlight.min.js:1:902923)
    at Object.Le [as dispatchEvent] (reveal.js:8:83748)
    at reveal.js:8:46814
    at Array.forEach (<anonymous>)
    at x.update (reveal.js:8:46145)
    at x.goto (reveal.js:8:47400)
    at x.prev (reveal.js:8:47874)
    at Object.yt (reveal.js:8:97262)
    at T.onDocumentKeyDown (reveal.js:8:54595)
getHighlightedLineBounds @ highlight.min.js:1
scrollHighlightedLineIntoView @ highlight.min.js:1
Le @ reveal.js:8
(anonymous) @ reveal.js:8
update @ reveal.js:8
goto @ reveal.js:8
prev @ reveal.js:8
yt @ reveal.js:8
onDocumentKeyDown @ reveal.js:8

that points to this line
getHighlightedLineBounds: function(e) {
-> e = e.querySelectorAll(".highlight-line");

This error appears only when you change from the second line to the first and not after the second line when you try to change lines with the keyboard arrow and it happens even with the original template.

https://github.com/hakimel/reveal.js/blob/master/index.html#L351

The only way i found to fix it is using fragments like this and only with many pre elements. If i use one pre element with a code the lines don't get highlighted one by one with the keyboard arrows. The framework just highlights all the code at once.

  <pre class="highlight"><code class="highlight fragment highlight-block featured-code" data-fragment-index="1">&#9193; &#9193; &#9193;    A</code></pre>
  <pre class="highlight"><code class="highlight fragment" data-fragment-index="2">&#9193; &#9193; &#9193;    Shift + Space</code></pre>
  <pre class="highlight"><code class="highlight fragment" data-fragment-index="3">&#9193; &#9193; &#9193;    Control + Alt + U + .</code></pre>
  <pre class="highlight"><code  class="highlight fragment" data-fragment-index="4">&#9193; &#9193; &#9193;    Control + Shift + &#39;</code></pre>
  <pre class="highlight"><code  class="highlight fragment" data-fragment-index="5">&#9193; &#9193; &#9193;    Alt+Shift+P Control+F</code></pre>
  <pre class="highlight"><code class="highlight fragment" data-fragment-index="6">&#9193; &#9193; &#9193;    Meta+C Meta+Shift+C</code></pre>

I have tried everything including all the other ways of the framework documentation and some custom javascript didnt work either as intended. Can you please look into it?

@hakimel
Copy link
Owner

hakimel commented Nov 13, 2023

This should be fixed in bbd0d3e. Give it a try when you get a chance and let me know if you still run into this.

@hakimel hakimel closed this as completed Nov 13, 2023
@leonalkalai
Copy link
Author

leonalkalai commented Nov 16, 2023

@hakimel i tried with the new pugin.js that you have the change bbd0d3e
but unfortunately i have the same error.
Can you please test it yourself and look out for a fix?

@hakimel
Copy link
Owner

hakimel commented Nov 16, 2023

I just re-ran my test again and it's still fixed for me.

I used the content below to test (from your example). When stepping backwards through all of the highlights there is always an exception. When I try the latest version in master there is no exception.

<div class="reveal">
  <div class="slides">
    <section><pre class="codestyle">
      <code class="language-html" aria-hidden="true" data-line-numbers="2|4|6|8|10|12">
        <span>&#9193; &#9193; &#9193;    A</span>
      
        <span>&#9193; &#9193; &#9193;    Shift + Space</span>
      
        <span>&#9193; &#9193; &#9193;    Control + Alt + U + .</span>
      
        <span>&#9193; &#9193; &#9193;    Control + Shift + &#39;</span>
      
        <span>&#9193; &#9193; &#9193;    Alt+Shift+P Control+F</span>
        
        <span>&#9193; &#9193; &#9193;    Meta+C Meta+Shift+C</span>
      </code>
      </pre></section>
    <section>Slide 2</section>
  </div>
</div>

@leonalkalai
Copy link
Author

I only changed my plugin.js file with your plugin https://github.com/hakimel/reveal.js/blob/master/plugin/highlight/plugin.js and i got error.
Do i need to download the whole repo from the start or use some of the other files from the repo also?

@hakimel
Copy link
Owner

hakimel commented Nov 17, 2023

The plugin gets compiled into highlight.js and highlight.esm.js so those are the files you'll want to copy over. You can find them in the same directory: https://github.com/hakimel/reveal.js/tree/master/plugin/highlight

@leonalkalai
Copy link
Author

Thank you the error is fixed with the new files.

lenis0012 added a commit to chilit-nl/reveal.js that referenced this issue Jun 13, 2024
* Support multiple aside notes elements per slide

So far, multiple notes per slide are only supported if they are
attached to fragments (without fragments, only the first aside notes
element on a slide is displayed).  With this commit, the contents of
all notes on a slide are displayed (except for fragments with notes,
for which, as before, only each fragment's first/single note is
displayed).

* Add generated files

* update browserlist from '> 0.5%, IE 11, not dead' to '> 2%, not dead' hakimel#2985

* Missing lang attribute

The lang attribute does not default to English. It defaults to an unknown, which is an accessibility issue.

* fix issue with past/future vertical slides remaining visible in Safari 15.4 (closes hakimel#3164)

* fix issue were auto-animate could interfere with inherited line-height

* Update js.yml

Signed-off-by: sashashura <[email protected]>

* prevent extra \n at end of single notes hakimel#3010

* fix merge error, closes hakimel#3277

* remove doppler

* fix getAttribute exception in notes plugin hakimel#3285

* 4.4.0

* Gulp livereload: include subfolders to watch for changes in html and md

Currently it's only watching for changes to `.html` and `.md` files located in the root of the project. I was frustrated when livereload stopped working for me: turns out it was because I put my content into subfolders.

* roll back unintended change to index content

* Add theme 'dracula'

New theme using color palette from [Dracula](https://draculatheme.com/)
dark editor theme available for quite a number of different
applications.

* 2023

* only test one node version

* run tests in node 14

* audit fix

* spec updates

* adds jump-to-slide, press G to activate

* add jump-to-slide to help overlay, style tweaks

* delay slide jumps a few ms

* update hljs 10 > 11.7, fix perf issue in demo presentation caused by auto lang detection

* jump-to-slide is 1-indexed, falls back on word search

* better selection color contrast for black theme

* enforce a min length on jump to slide search queries

* fix incorrect condition for jump-to-slide

* jump to slide tweak

* fix security alerts by upgrading glob-parent hakimel#3343

* scope print styles to .reveal hakimel#3348

* Fixes typos

* Correctly strip leading white-space from markdown

If the markdown contains something that is indented by more that the
`leadingTabs`/`leadingWs` then extra white space is incorrectly removed.
ie the following example:

```
    <section data-markdown>
    some text
       indented text
          more indented text
    </section>
```

would result in the following markdown:

```
some text
   indented text
  more indented text
```

We can work around this problem by using a function to generate the
replace value.

* Add RFC3986-compliant URL format encoding

Fixes hakimel#3315

* add sortFragmentsOnSync option, makes it possible to avoid unwanted sorting in editing environments like slides.com

* Fix overview spacing for disabled auto layout (hakimel#3291)

* Fix overlap in overview when config.disableLayout === true

* run gulp js
after commit 9193e5c

---------

Co-authored-by: Hakim El Hattab <[email protected]>

* remove commented out config

* Black & White compact themes with verbatim headers. (hakimel#3310)

* rename high contrast themes, dont change anything else compared to black/white themes hakimel#3310

* reduce fragment style specificity, add custom class to reset fragment styles hakimel#2927

* build latest css

* 4.5.0

* add ln-start-from for code sections to markdown

* add tests

* fix code block auto-animate bug that caused unmatched lines to appear without fading in

* auto-slide duration falls back on global setting instead of looking at first fragment

* fix issue where fragment-evel autoslide timing was when multiple fragments share the same index

* fixes livereload when using root CLI param

* ignore node_modules for livereload

may allow perf boost

* allow theme subfolders

allows custom themes to import files from subfolders inside the `css/theme/source` folder.

in `css/theme/source/custom-theme.scss` we can now do
```scss
@import `custom-theme/controls`
@import `custom-theme/headings`
...
```

* adds ability to override markdown default options

```js
Reveal.initialize({
    markdown: {
        defaultOptions: {
            verticalSeparator: '\n--\n`,
        }
    }
})

* add support for links to the id of an element nested inside slide

fixes hakimel#3231

* build

* move markdown default options to top level hakimel#3443

* update markdown default notes separator to ignore inline occurances of 'notes:', closes hakimel#1915, closes hakimel#2762

* fix scss watch tasks broken on syntax error

when there is a syntax error in a sass file (theme or core) the npm start command used to hang, forcing the user to stop and restart the task to compile again.
this fix allows to keep the start-task watching/compiling even when there is an error :
- the error is displayed in terminal
- the rest of gulp tasks are not called (no reload in the browser)
- the user can edit the scss files to try a fix without the need to stop/restart the `npm start` command

* speed up livereload

connect.reload needs a stream of files to fire, but this stream is irrelevant here and slows refresh time a lot (from ~2ms to 2000ms here)

* Fix dracula's theme list-style on sub-items

* fix typos in variable names

* Refactored var to let or const, strict equality

* build md plugin hakimel#3454

* Update demo.html

switch themes keep current slide

* fix code blocks font when printing pdf

fixes hakimel#2867

* add start/stopEmbeddedMedia API methods for controlling playback of video/audio/iframes

* fix dracula li markers

replace :before pseudo elements with :marker selector

allows to have different marker based on the level of nesting (as in other themes : disc, square, circle)

* fix dracula theme li numbering

* refactor dracula theme sass code

* add test deck with 500 slides

* 4.6.0

* fix alpha overlap during scrolled code highlight transitions

* foundation for reader mode, activate via 'mode=reader/print' config param

* 4.6.1, remove log

* separate reader mode into individual controller, add scroll triggers for fragments

* revert demo changes to index.html

* reader mode; deeplink support, presentation scaling, scroll trigger fixes

* refactoring, fix preload distance

* fix empty slide bug when all slides in a stack are hidden via data-visibility

* Notes plugin: notes from data-notes attribute were not shown

* add support for aside element notes inside of fragments (fixes hakimel#3478)

* reader mode can be turned off without reload, add Reveal.toggleReader()

* revamped reader mode sticky logic, add option for fullscreen pages

* rename 'mode' config value to 'view'

* reader mode supports scroll snapping, sticky pages with scroll triggers are always full height

* fix preload bug

* refactoring, remove unused layout

* dispatch slidechange events in reader mode

* fix incorrect unit for slide-width/height css variable hakimel#1263

* fix issues with active slide logic in reader mode, foundational work for auto-animate support

* update api method name

* Support to 'wheel' event listener

* add support for responsively activating reader mode via

* reader mode tests

* refactoring

* reader mode; named deeplink support, stay on same slide when reader mode is turned on/off

* reader mode progress bar

* reader mode progress bar can be dragged to scroll

* finishing touches on reader mode progress bar

* refactoring

* mobile tweaks

* reader progress theming, automatically invert based on slide bg

* convert sass controls spacing to css var, full height reader progress bar

* disable overview while in reader mode

* audit fix

* more accurate scroll trigger positioning in progress bar

* reader mode tweaks

* reader mode accessibility, bug fixes

* readerScrollBar -> readerScrollbar

* rebuild assets

* prevent extra page at end when printing to pdf, reader mode styling tweaks

* don't show reader scroll bar when there is no overflow, reader style tweaks

* ===

* audit fix

* add scroll snap points for reader mode scroll triggers

* massive reader mode refactor; adds support for auto-animate + snapping for fragments

* major cleanup of reader mode code

* improved reader progress bar visuals in high density

* reader mode refactoring

* reader mode remembers scroll position when reloading

* fix slide numbers not visible in pdf exports

* ? keyboard shortcut should not trigger when focus is on an editable element fixes hakimel#2645

* reader mode now works for embedded decks

* fix scroll snapping in reader mode compact layout

* reader mode -> scroll view, auto-enable below 435px width

* fix scroll view activation in tests

* not so important

* not important

* remove legacy mousewheel listeners hakimel#3489

* 5.0

* mute video in scroll demo

* chore: fix typos

* chore: remove deprecated css declarations

* chore: bump deps

* rebuild after deps update

* scroll example deck tweaks

* fix speaker view bug, bump version to 5.0.1 hakimel#3512

* md plugin api works even if deck isn't available hakimel#3517

* nil check for deck in md plugin hakimel#3517

* fix issue where background of a future vertical slide is briefly visible ahead of time hakimel#3520

* 5.0.2

* jump-to-slide; add support for 'h.v' format, adapat to match slide number format hakimel#3501

* fix exception when stepping backwards through code highlights hakimel#3524

* bump 5.0.2 version in build files

* search plugin; allow searching for any character (was alphanum) hakimel#2331 hakimel#3532

* search plugin; search for whole phrase hakimel#2331 hakimel#3532

* fix notes in pdf print view hakimel#3535

* fix exception when navigating decks on mobile browsers hakimel#3539

* fix broken mobile scroll view navigation where there were fragments starting at an index above 1 hakimel#3540

* fix pause/help overlay position in scroll mode (closes hakimel#3542)

* fix: use `setAttribute` instead of `innerHTML` to prevent xss

* rebuild

* fix missing backgrounds when scroll view is actived responsively (fixes hakimel#3554)

* 2024

* add support for keyboard navigation in scroll view hakimel#3515

* fix xss issue reported by @realansgar, regression from 3dade61

* add logs to scrollview.js

* update build

* update build

* fix slide backgrounds being replaced by global background

* fix selector constant

* remove console logs

* fix selector constant

* add comment for background fix

* tweaks for hakimel#3568

* add F1 key to toggleHelp for non-english keyyboards

* indentation tweak

* fix fragment events not firing in scroll view + add tests hakimel#3580

* 5.0.5

* new .enter-fullscreen class lets you add shortcuts to fullscreen mode

* fix broken backwards navigation in rtl mode

* dont prevent swipe navigation on video backgrounds hakimel#3584

* allow same background video to continue playing across multiple slides hakimel#3189 hakimel#2882

Co-authored-by: Chi Vong <[email protected]>

* don't restart media when it's already playing hakimel#2882

* fix issue when disabling autoPlay config flag at runtime

* don't start video bgs if autoPlayMedia config is set to false

* fix previous bg video playing in background

* fix rtl prev/next navigation on slides with fragments

* Notes: don't error on non-string message

* fix vertical swipe navigation not blocking page scrolling in embedded decks

* fix exception when destroying uninitialized reveal instance (closes hakimel#3593)

* MathJax3: allow non-singleton Reveal instance

* fix r-stack with `grid-template-rows: 100%;`

* update build

* nil check slides before running auto-animate transition hakimel#3592

* auto-animate demo tweak

* Re-add question mark for help

* 5.1.0

* chore: update package lock

* feat: add first draft of jspring 2024 keynote slides

* chore: updates slides

* chore: update slides with new graphics

* feat: add breakout alides

* feat: add extra slides based on feedback

---------

Signed-off-by: sashashura <[email protected]>
Co-authored-by: Jens Lechtenbörger <[email protected]>
Co-authored-by: hakimel <[email protected]>
Co-authored-by: Sam <[email protected]>
Co-authored-by: Alex <[email protected]>
Co-authored-by: Andrey Mikhaylov (lolmaus) <[email protected]>
Co-authored-by: Juhamatti Niemelä <[email protected]>
Co-authored-by: Andreas Deininger <[email protected]>
Co-authored-by: John Kristensen <[email protected]>
Co-authored-by: Martino <[email protected]>
Co-authored-by: Elliot" Constantin H <[email protected]>
Co-authored-by: Peter Kehl <[email protected]>
Co-authored-by: Florian Klien <[email protected]>
Co-authored-by: t-fritsch <[email protected]>
Co-authored-by: Gildasio Junior <[email protected]>
Co-authored-by: Artur Neumann <[email protected]>
Co-authored-by: Prarup Gurung <[email protected]>
Co-authored-by: Ricardo Menotti <[email protected]>
Co-authored-by: Yevhen Kozlov <[email protected]>
Co-authored-by: NGUYEN DINH Quoc-Huy <[email protected]>
Co-authored-by: Mr.Hope <[email protected]>
Co-authored-by: Michael Wang <[email protected]>
Co-authored-by: Anas Bouzid <[email protected]>
Co-authored-by: Christian Ziemski <[email protected]>
Co-authored-by: Chi Vong <[email protected]>
Co-authored-by: Nat Karmios <[email protected]>
Co-authored-by: Wang Guan <[email protected]>
Co-authored-by: alifeee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants