On Saturday, June 7, 2014 1:13:08 AM UTC+2, Новак Бошков wrote:
>
> Today is my first day using Firebug and I'm noticed that I can't stop 
> debugger on a line outside of function.
> There is following code:
>                 var oneClassContener = $(".oneClass");
>                 [breakpoint]for (var i=0; i<oneClassContener.length; i++){
>                     if (oneClassContener[i].tagName === "IMG"){
>                         document.write('<img src="' + oneClassContener[i].
> src.split("/")[oneClassContener[i].src.split("/").length - 1] + '"></img>' 
> + "<br />");
>                     } else {
>                         document.write(oneClassContener[i].innerHTML);   
>                     }
>                 }
>
> And debugger just passes by the breakpoint. Code works but i want to stop 
> execution on this line.
> If I surround the code from above with a anonymous function and make a 
> call after that, then debugger works like I expect and stops on specified 
> line.
> Like this:
>                 var foo = function(){
>                 var oneClassContener = $(".oneClass");
>                 [breakpoint]for (var i=0; i<oneClassContener.length; i++){
>                     if (oneClassContener[i].tagName === "IMG"){
>                         document.write('<img src="' + oneClassContener[i].
> src.split("/")[oneClassContener[i].src.split("/").length - 1] + '"></img>' 
> + "<br />");
>                     } else {
>                         document.write(oneClassContener[i].innerHTML);   
>                     }
>                 }
>                 foo();
>                 }
> Have I missed some settings or is it a bug?
> If there is reasonable reason for this, what is it?
> Thank you. 
>

i think there is a small bug in your second code example?! 
var foo = function(){
    var oneClassContener = $(".oneClass");
    [breakpoint]for (var i=0; i<oneClassContener.length; i++){
        if (oneClassContener[i].tagName === "IMG"){
            document.write('<img src="' + oneClassContener[i].src.split("/"
)[oneClassContener[i].src.split("/").length - 1] + '"></img>' + "<br />");
        } else {
            document.write(oneClassContener[i].innerHTML); 
        }
    } // end for loop
    foo();
} // end anonymous function

so the foo(); should be outside of the function body?!

sunny greetings
stefan

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/firebug.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/firebug/27e87772-2f30-488c-a499-94147e6c2e04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to