There are many documented (and undocumented) nuances between browsers and how they process a request. Today I came across one that had me stumped for the better part of the day.
I have a bit of jquery that looks like this:
$.get(this.href, function (result) {
$(result).dialog();
});
with the assumption that result returns a single DOM element, typically a form element. This was working well until the following result occurred
<form>
<script type=”text/javascript”>/*code goes here*/</script>
</form>
in this scenario the result was in the correct format, but the browser interprets this as
<form></form>
<script type=”text/javascript”>/*code goes here*/</script>
This result will produce to dialog boxes. The one you expect and a second one where you only see a title bar. The second dialog has no content, but scripts don’t have a visual representation. I account for this anomaly I had to munge with the jquery script.
$.get(this.href, function (result) {
$(result).first().dialog().append($(result).last());
});
Hopefully this will all become a mute point later on. I would like to implement client side templating and keep server calls to json response, but we are not there yet.