Create UI Dialog from a node, that may contain <script> tag..?

Create UI Dialog from a node, that may contain <script> tag..?

In my case UI Dialog fails to create a dialog from a node that contains <script> tag. That node may or may not contain <script> tag, it depends on apps logic. Is it meant to work in general?

The most illustrative case would be creating a dialog from a third party form, which may contain additional logic passed from remote server through a hybrid local/remote javascript (like Aweber does for example).

Is there any easy way to handle this?