On Fri, 2009-09-25 at 12:52 -0600, Weygandt, Jon wrote:
> gadgets.log, it's part of the mandatory core API, but yet Shindigs
> implementation only works for browsers with a window.console 
<snip>
> After doing some googling I discovered that most people advocate
> creating a <div> and placing messages in the div. Seems a workable idea,
> plus we could call adjustHeight after doing so. The one question is what
> should we use to make the <div> visible for debugging purposes? 
>  
> One idea is to capture some obscure keystroke or mouse click event on
> document.body to make the div visible.

The old javascript/container/gadgets.js used to log messages in that
way:

gadgets.log = function(message) {
  if (window.console && console.log) {
    console.log(message);
  } else {
    var logEntry = document.createElement('div');
    logEntry.className = 'gadgets-log-entry';
    logEntry.innerHTML = message;
    document.body.appendChild(logEntry);
  }
};

How about appending the elements to a span with style set to
"display:none" (rather than to the body as above), so that while
debugging you can make the entire log visible by a style change?


Tim W


Reply via email to