summernote: "TypeError: a is null" thrown only in FireFox
I get “TypeError: a is null” thrown only in FireFox.
It show this bit as causing the error:
...1?" ":"<br>",G=function(a){return g(a)?a.nodeValue.length:a.childNodes.leng...
----------------------------------------------------------^
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 16 (1 by maintainers)
Commits related to this issue
- Patch for firefox fix in issue summernote/summernote#1667 — committed to ZeroarcSoftware/summernote by deleted user 8 years ago
I’m also getting this error, and it only occurs in Firefox. The page I’m working on is rather complicated, so I’m unable to isolate a test case. However, using the un-minified version, I was able to track down the error. The exact error message is actually “TypeError: node is null” and here’s the stack trace for version 0.8.1:
I did some digging and in the getVisiblePoint() function call, for some reason the block variable is null:
Later on, when the isRightEdgeOf() function is called, it traverses up the dom tree. But, when it reaches the top, node.parentNode is null and nodeLength(node.parentNode) throws the error message (because null has no childNodes). My (probably incorrect) work around was to simply add the following line to the nodeLength() function:
if (node === null) { return 0; }
Thanks @lesilent
I had the same problem in firefox and corrects the problem by following your tip follows the amendment