lib/js/JsonView.js
function(elem) {
      var t = this,
          strValue;

      // Catch recursive stringify
      try {strValue = JSON.stringify(elem.value);}
      catch (e) {strValue = "{object}";}

      // Set if the value changed
      if (strValue !== elem.strValue) {
        var priorStrValue = elem.strValue;
        elem.strValue = strValue;

        // Set the value of this element or the inner element
        elem.span.text(strValue);
        if (elem.innerView) {
          elem.innerView.model = elem.value;
          elem.innerView.setData();

          // Set the inner element open or closed
          var isClosed = false;
          if (priorStrValue) {
            isClosed = elem.innerView.isClosed;
          } else {
            isClosed = t.closedOnInit ? true : strValue.length < AUTO_CLOSE_CHARS;
          }
          t.toggleClosed(elem, isClosed);
        }
      }
    }
function(elem) {
      var t = this,
          strValue;

      // Catch recursive stringify
      try {strValue = JSON.stringify(elem.value);}
      catch (e) {strValue = "{object}";}

      // Set if the value changed
      if (strValue !== elem.strValue) {
        var priorStrValue = elem.strValue;
        elem.strValue = strValue;

        // Set the value of this element or the inner element
        elem.span.text(strValue);
        if (elem.innerView) {
          elem.innerView.model = elem.value;
          elem.innerView.setData();

          // Set the inner element open or closed
          var isClosed = false;
          if (priorStrValue) {
            isClosed = elem.innerView.isClosed;
          } else {
            isClosed = t.closedOnInit ? true : strValue.length < AUTO_CLOSE_CHARS;
          }
          t.toggleClosed(elem, isClosed);
        }
      }
    }
function ( elem ) { var t = this , strValue ; // Catch recursive stringify try { strValue = JSON . stringify ( elem . value ) ; } catch ( e ) { strValue = "{object}" ; } // Set if the value changed if ( strValue !== elem . strValue ) { var priorStrValue = elem . strValue ; elem . strValue = strValue ; // Set the value of this element or the inner element elem . span . text ( strValue ) ; if ( elem . innerView ) { elem . innerView . model = elem . value ; elem . innerView . setData ( ) ; // Set the inner element open or closed var isClosed = false ; if ( priorStrValue ) { isClosed = elem . innerView . isClosed ; } else { isClosed = t . closedOnInit ? true : strValue . length < AUTO_CLOSE_CHARS ; } t . toggleClosed ( elem , isClosed ) ; } } }
Set the DOM element value to the JSON.stringify format
Set the DOM element value to the JSON . stringify format