+ /**
+ * Maps textContent of <script type="application/vnd.drupal-ajax"> to an AJAX response.
+ *
+ * @param {string} content
+ * The text content of a <script type="application/vnd.drupal-ajax"> DOM node.
+ * @return {Array|boolean}
+ * The parsed Ajax response containing an array of Ajax commands, or false in
+ * case the DOM node hasn't fully arrived yet.
+ */
+ function mapTextContentToAjaxResponse(content) {
+ if (content === '') {
+ return false;
+ }
+
+ try {
+ return JSON.parse(content);
+ }
+ catch (e) {
+ return false;
+ }
+ }
+