[Bug] Hover editor result in TypeError: this[0].getAttribute is not a function
-
Are you using the latest release (older versions are NOT supported)? Yes, using latest v0.16.3 version.
-
What happen?
Upgraded from WORKING v0.15.3 to v0.16.3. Also, went back and verify that this is WORKING in v0.15.10
Demo to reproduce the problem https://niiknow.github.io/grapesjs-components-farmer/ in latest Firefox and Chrome.
Error output to Chrome console:
Uncaught TypeError: this[0].getAttribute is not a function
at Cash../node_modules/cash-dom/dist/cash.esm.js.fn.attr (grapes.js:3475)
at getData (grapes.js:3677)
at Cash../node_modules/cash-dom/dist/cash.esm.js.fn.data (grapes.js:3730)
at child.onHover (grapes.js:27349)
at executeBound (grapes.js:18742)
at HTMLBodyElement.<anonymous> (grapes.js:18755)
at HTMLBodyElement.<anonymous> (grapes.js:18102)
Debug show that, on hover of the body DOM, it try to try to get model data of body.parent which is the document object.
@noogen can you please create a reproducible demo on something like jsfiddle? (without your preset/plugin, so I know the issue comes from the core)
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
I'm also having this issue. With me it happens whenever i try to canvas option in init.
const editor = grapesjs.init({
// Indicate where to init the editor. You can also pass an HTMLElement
container: '#gjs',
// Get the content for the canvas directly from the element
// As an alternative we could use: `components: '<h1>Hello World Component!</h1>'`,
fromElement: true,
width: 'auto',
// Disable the storage manager for the moment
storageManager: false,
plugins: ['gjs-preset-webpage'],
pluginsOpts: {
'gjs-preset-webpage': {
// options
}
},
canvas: {
styles: [
`@asset('css/front/style.min.css')`,
`@asset('css/front/bootstrap.min.css')`,
],
scripts: [
`@asset('js/front/jquery.min.js')`,
`@asset('js/front/bootstrap.bundle.min.js')`,
`@asset('js/front/plugins.min.js')`,
`@asset('js/front/main.min.js')`,
],
}
});
When i remove the canvas config part in the options everything seems to work fine.
In css/front/style.min.css do you have anything like
body { padding: 1rem; }
As in my inserted stylesheet the padding on the body element was causing the issue. Not in the slightest sure why...
I solved my issue. The problem was in my js/front/main.min.js was pushing a loader inside the body element (preloader) and for some reason grapesjs wasn't liking that. Once i removed it everything worked as it should do.