ember-modal-dialog icon indicating copy to clipboard operation
ember-modal-dialog copied to clipboard

Computed value should check data type

Open patric-eberle opened this issue 7 years ago • 1 comments

I'm currently figuring out why I still get the error from #195 with the latest version in my implementation. Beside that I noticed some critical data handling in the computed properties of basic-dialog.js:

https://github.com/yapplabs/ember-modal-dialog/blob/c6c783c7a4caa7e70cf5c7cca15e4f4a595386ac/addon/components/basic-dialog.js#L24

The marked line gets the containerClassNames data and executes join() without type testing. This is meant to crash, since the default is already null, the computed is listening to other properties as well and invalid data could also be given from outside. Note, that there are multiple places in this file, where the same issue occurs.

patric-eberle avatar Feb 06 '18 10:02 patric-eberle

I think the #195 related error was also triggered by one/some of the computed values of basic-dialog.js in this case. I initially had defined custom classes for wrapperClass, overlayClass and containerClassNames. Which caused crashing in IE11. I now added an array value for wrapperClassNames and overlayClassNames and the modal is now also working in IE11. I guess, that the computed values now at least have valid data to work with (but did not further investigate it).

Did not work in IE:

{{#modal-dialog
    wrapperClass=_wrapperClass
    overlayClass=_overlayClass
    containerClassNames=_containerClassNames
    hasOverlay=hasOverlay
    renderInPlace=renderInPlace
    targetAttachment=_targetAttachment
    onClickOverlay=(action "onClickOverlay")
}}
{{/modal-dialog}}

Does work in IE:

{{#modal-dialog
    wrapperClass=_wrapperClass
    overlayClass=_overlayClass
    containerClassNames=_containerClassNames
    wrapperClassNames=_wrapperClassNames
    overlayClassNames=_overlayClassNames
    hasOverlay=hasOverlay
    renderInPlace=renderInPlace
    targetAttachment=_targetAttachment
    onClickOverlay=(action "onClickOverlay")
}}
{{/modal-dialog}}

patric-eberle avatar Feb 06 '18 12:02 patric-eberle