Opened 8 years ago

Closed 8 years ago

#16779 closed Bug (invalid)

config.fillEmptyBlocks not working as function

Reported by: Scott Owned by:
Priority: Normal Milestone:
Component: Core : Parser Version:
Keywords: Cc:

Description

Hello

I am trying to configure CKE to NOT add space to my clear_fix div.

I have windows 7 pro 64, and have tried IE11, Chrome 55.0.2883.87(64-bit), and FF 50.1.0(64-bit).

I have the basic plugins, plus stylesheetparser, enhanced image, and I installed devtools to see if I could solve this.

I also config.removePlugins = 'stylesheetparser';

and I am getting the same error

According to bug #10422 this has been discovered and fixed, but unless I am doing something wrong, I believe the docs say I can do this but it is not working for me. My div has a class of clear_fix, not clear-both

config.fillEmptyBlocks = function( element ) {

if ( element.attributes[ 'class' ].indexOf( 'clear_fix' ) != -1 )

return false;

};

I have the above setting in my config.js file.

Note, this works fine: config.fillEmptyBlocks = false;

In chrome I get Uncaught TypeError: Cannot read property 'indexOf' of undefined

in FF I get TypeError: element.attributes.class is undefined

Change History (1)

comment:1 Changed 8 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 4.6.1

You need to remember that not all elements have this class thus this should rather look like:

...
var attr = element.attributes[ 'class' ];					
if (attr && attr.indexOf( 'clear_fix' ) != -1 )
...
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy