BUG: TypeError: Cannot read property 'querySelector' of null
Question
I was getting this error while writing unit tests and I am testing editor instance to be defined. Randomly test case is passing but mostly I am getting this error.
Answers (2)
It seems like u are missing the class name or parent element ID.
below is the example of using querySelector.
<pre>
var parentElement = document.getElementById('deviceready');
var listeningElement = parentElement.querySelector('.listening');
console.log(listeningElement);
<div id="deviceready">
<div class="listening">
</div>
</div>
</pre>Sorry but this might depend on way too many factors (eg. your environment) and has nothing to do with the core itself.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3267
BUG: Cannot set 0px box shadow blur
For some reason, the editor does not allow to set the blur to 0px. 0 always magically turns into 5px. <img width="243" alt="Screenshot 2021...
Issue #3033
While Dragging component to top, removed event is not triggered for another component
<img width="949" alt="Screenshot 2020-09-20 at 10 12 52 AM" src="https://user-images.githubusercontent.com/55732888/93694492-ee644100-fb29-...
Issue #2545
Error while resizing with golden layout: Cannot read property 'appendChild' of null
index.js:129 Uncaught TypeError: Cannot read property 'appendChild' of null at Object.postRender (index.js:129) at index.js:757 at Array.fo...
Issue #3464
BUG: Editing button text doesn't work correctly
Description0 - Visit: https://grapesjs.com/demo.html1 - Select button: <img width="674" alt="Screenshot 2021-05-19 at 15 09 53" src="https:...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.