it's really old code but it still works and it fit inside debug very
well... so I keep it!

On 1/23/07, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote:
> ooops!
> you can see the whole bunch of my little javascript toys at
> http://jpassoc.com/js/my.js
>
> here's jso
> function jsO(obj) { // convert to simple js object for quick and dirty
> access almost anything // not a good function for dom stuff because of
> duplicate chidlren tags
>         if (typeof obj == "object") {
>                 var res = "{\n";
>                 var v = Array(0);
>                 var val=obj.nodeValue;
>                 if (val){
>                         res += "'" + val + "'\n";
>                 } else if (obj.nodeType){ // a dom node!
>                         res +=  
> obj.nodeName.replace(/-/g,"_dash_").replace(/#/g,"_hash_") + ":{";
>                         if (obj.hasAttributes()) {
>                                 var attrs = obj.attributes;
>                                 for (var i = 0; i < attrs.length; i++){
>                                         var attr=attrs[i];
>                                         v[v.length] = "_" + attr.name + ":'" 
> + attr.value + "'\n";
>                                 }
>                         }
>                         if (obj.hasChildNodes()) {
>                                 var children = obj.childNodes;
>                                 for (var i = 0; i < children.length; i++){
>                                         v[v.length] = "" + i + ":" + 
> jsO(children[i]) + "\n";
>                                 }
>                         }
>                 } else {
>                         for (var item in obj){
>                                 try {
>                                         v[v.length] = "" + item + ":" + 
> jsO(obj[item]) + "\n";
>                                 } catch (e) {
>                                         v[v.length] = "" + item + 
> ":'whoops'\n";
>                                 }
>                         }
>                 }
>                 res += v.join(",") + '}\n';
>                 return res;
>         } else {
>                 //if (obj.length > 20) obj = obj.substr(0,20) + "…";
>                  return obj;
>         }
> }
>
>
> On 1/23/07, Daemach <[EMAIL PROTECTED]> wrote:
> >
> > Well it looks really cool, but I couldn't get it to work :/  In the immortal
> > words of Riddick:
> >
> > "Pretend you're talking to someone who was educated in the penal system...
> > In fact, don't pretend."
> >
> > Here's what I tried:
> >
> > $('[EMAIL PROTECTED]').debug("boo").each( function() 
> > {$(this).before('Current
> > length: <span style="color:'+((this.value.length >
> > parseInt(this.id.split("_")[1]))?'red':'green') +'" id="'+ this.id
> > +'_len">'+this.value.length.toString()+'</span> characters<br>').keyup(
> > function() {$('#'+ this.id +
> > '_len').html(this.value.length.toString()).css('color', ((this.value.length
> > > parseInt(this.id.split("_")[1]))?'red':'green')); } ); } );
> >
> > and the error I get is:  jsO is not defined
> >
> >
> >
> > Ⓙⓐⓚⓔ wrote:
> > >
> > > you slap it up in any of your scripts... or a special one (just for
> > > debugging)
> > >
> > > then you can insert .debug("any label") anywhere along the chain!
> > >
> > > On 1/23/07, Daemach <[EMAIL PROTECTED]> wrote:
> > >>
> > >> Please don't forget that a noob started this thread ;)  How do I use that
> > >> code block?
> > >>
> > >>
> > >>
> > >> Ⓙⓐⓚⓔ wrote:
> > >> >
> > >> > Mike, I don't like breaking the chains... I just insert a debug in the
> > >> > middle of the chain...
> > >> >
> > >> > I use this for my debug:
> > >> > jQuery.fn.debug = function(message) {
> > >> >       return this.log('debug:' + (message || '')
> > >> > +"[").each(function(){jQuery.log(this);}).log("]");
> > >> > }
> > >> > jQuery.fn.log = jQuery.log = function(message) {
> > >> >       if (!message) message = 'UNDEFINED'
> > >> >       if (typeof message  == "object") message = jsO(message)
> > >> >       if(window.console && window.console.log) //safari
> > >> >               window.console.log(message)
> > >> >       else if(window.console && window.console.debug) //firebug
> > >> >               window.console.debug(message)
> > >> >       else
> > >> >               jQuery("body").prepend(message+ "<br/>")
> > >> >       return this
> > >> > }
> > >
> > >> >
> > >> > --
> > >> > Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
> > >> > _______________________________________________
> > >> > jQuery mailing list
> > >> > discuss@jquery.com
> > >> > http://jquery.com/discuss/
> > >> >
> > >> >
> > >>
> > >> --
> > >> View this message in context:
> > >> http://www.nabble.com/What-tools-should-I-use-to-troubleshoot-jquery-problems--%28John-Resig%2C-jquery-team%2C-other-gurus-please-share-your-tricks...%29-tf3066235.html#a8552883
> > >> Sent from the JQuery mailing list archive at Nabble.com.
> > >>
> > >>
> > >> _______________________________________________
> > >> jQuery mailing list
> > >> discuss@jquery.com
> > >> http://jquery.com/discuss/
> > >>
> > >
> > >
> > > --
> > > Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
> > > _______________________________________________
> > > jQuery mailing list
> > > discuss@jquery.com
> > > http://jquery.com/discuss/
> > >
> > >
> >
> > --
> > View this message in context: 
> > http://www.nabble.com/What-tools-should-I-use-to-troubleshoot-jquery-problems--%28John-Resig%2C-jquery-team%2C-other-gurus-please-share-your-tricks...%29-tf3066235.html#a8553297
> > Sent from the JQuery mailing list archive at Nabble.com.
> >
> >
> > _______________________________________________
> > jQuery mailing list
> > discuss@jquery.com
> > http://jquery.com/discuss/
> >
>
>
> --
> Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
>


-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to