rijs / fullstack

modern fullstack framework
242 stars 21 forks source link

render(ripple) called for custom component on Chrome but not IE 11 #24

Closed whittala closed 8 years ago

whittala commented 8 years ago

I had a custom component accountsFilter defined in file accounts-filter.js with a css file accounts-filter.css. I added the tag with passing the data using once:

o('accounts-filter', { filterAccounts: data , accountGroups: accountGroups , changeFilters: changeFilters , dispatcher: dispatcher , selected: undefined , focused: isActive , open: isActive }) .attr('css', 'accounts-filter.css') .on('change.accounts', changeAccounts)

On chrome the render(ripple) method calls the custom component function:

export default function accountsFilter(state) { var o = once(this)

However on IE11 the render(ripple) function doesn't call this method.

We added a change to force ripple to draw it on IE11:

o('accounts-filter', { filterAccounts: data , accountGroups: accountGroups , changeFilters: changeFilters , dispatcher: dispatcher , selected: undefined , focused: isActive , open: isActive }) .attr('css', 'accounts-filter.css') .on('change.accounts', changeAccounts) .each(ripple.draw)

but don't really understand why the render(ripple) method was not called.

pemrouz commented 8 years ago

Ok, I think I know what this is finally. Skip to end for TL;DR, some background for understanding:

As a result, I think this area can be slightly improved: By just setting Element.prototype.draw = ripple.draw, once will correctly draw existing and newly added elements. This means we can drop the MutationObserver polyfills for IE11/FF, and it will also work exactly the same for the likes of IE9 - without all the extra .each(ripple.draw) :tada:..

pemrouz commented 8 years ago

New release published, with explanation here (note you may want to "watch" this repo to receive future digests by email). I've also added IE9 to list of browsers to run on the CI so we'll know for future releases if we break anything in older browsers. Let me know if this helps..