ClassClassApplier options elementAttributes

24 views
Skip to first unread message

Tobi

unread,
Jun 3, 2014, 7:42:19 AM6/3/14
to ra...@googlegroups.com
Hi Tim,

a question regarding the options for createCssClassApplier.

Setting an attribute via options.elementAttributes works well for elements which are newly created.

But when I want to add a class to an existing span which does not have an options.elementAttributes the CSS class is applied correctly but without considering the options.eementsAttributes.

Example:

var conf = {
             normalize: true,
            applyToEditableOnly: true
            };


bold = rangy.createCssClassApplier('bold, conf);

var link_conf = {
           normalize: true,
            applyToEditableOnly: true,
            elementAttributes: {
                'data-resid': -1
            }
 };
           
// create instance for linking first
link = rangy.createCssClassApplier('_link', link_conf);
           


If I a make selection in my div (contenteditabe="true") and execute bold.toggleSelection() and then link.toggleSelection() I would expect rangy to also add resid=-1 as an attribute to the span.

Are my assumptions wrong? What effect does options.normalize have?

Thanks and regards

Tobi
Reply all
Reply to author
Forward
0 new messages