Skip to content

Commit

Permalink
use optional data-attributes on textarea for status and statusText
Browse files Browse the repository at this point in the history
  • Loading branch information
laurens committed Apr 14, 2012
1 parent 39f3638 commit b8a25d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jquery.iframe-transport.js
Expand Up @@ -183,14 +183,16 @@
root = doc.documentElement ? doc.documentElement : doc.body,
textarea = root.getElementsByTagName("textarea")[0],
type = textarea ? textarea.getAttribute("data-type") : null,
status = textarea ? textarea.getAttribute("data-status") : 200,
statusText = textarea ? textarea.getAttribute("data-statusText") : "OK",
content = {
html: root.innerHTML,
text: type ?
textarea.value :
root ? (root.textContent || root.innerText) : null
};
cleanUp();
completeCallback(200, "OK", content, type ?
completeCallback(status, statusText, content, type ?
("Content-Type: " + type) :
null);
});
Expand Down

1 comment on commit b8a25d1

@vampirefrog
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the textarea exists but does not have data-status and data-statusText attributes, they end up being NULL.

Patch here: #17

Please sign in to comment.