michaelpapworth / tinymce-knockout-binding

A KnockoutJS custom binding that applies a TinyMCE Editor to the bound HTML element
MIT License
39 stars 19 forks source link

Issue in IE11 (IE8 compatibility mode) #8

Closed SuneRadich closed 10 years ago

SuneRadich commented 10 years ago

At line ~13 you extract any possible extensions, or return an empty array

// Get any extensions that have been enabled for this instance.
ext = allBindings.has( 'wysiwygExtensions' ) ? allBindings.get( 'wysiwygExtensions' ) : [],

Then later line ~29

for (var name in ext) {
    ko.bindingHandlers['wysiwyg'].extensions[ ext[ name ] ]( editor, args, allBindings, bindingContext );
}

Here you iterate over this array. In IE11, set to compatibility mode IE8, this fails. Because the empty array is looped over anyways.

I cant quite figure out if its an error that you return an empty array and not an object, or if the loop should be made like this:

for (var name in ext) {
    if (ext.hasOwnProperty(name)) {
        ko.bindingHandlers['wysiwyg'].extensions[ext[name]](editor, args, allBindings, bindingContext);
    }
}

Both solution fixes the issue for me, but because I havent the insight in how extensions or TinyMCE works, I havent made a pull request to fix this. I would not know what solution is the right one.

michaelpapworth commented 10 years ago

Thank you for your interest in the project. Having reviewed the code your first observation is quite correct. I have made an error at line ~13 and I should have returned and object in place of the array. If you are happy to submit the PR that would be great.