marko-js-archive / marko-widgets

[LEGACY] Module to support binding of behavior to rendered UI components rendered on the server or client
http://v3.markojs.com/docs/marko-widgets/
MIT License
141 stars 40 forks source link

Allow widgets to be rendered into another frame #112

Closed philidem closed 8 years ago

philidem commented 8 years ago

During widget initialization, it is currently assumed that the widgets will be found in the current window.document since document.getElementById(...) is used to find the widget elements that were rendered. I have a use case for rendering widgets into another frame. Something like:

var iframeEl = document.getElementById('some-iframe');
MyWidget.render({message: 'Hello'}).appendTo(iframeEl.contentWindow.document.body);

I have a fix that seems to be working properly and backwards compatible. I'll create pull request after a little more testing.