Subscribe to
Posts
Comments

I found there was always a Javascript


script error saying “’Draggables.drag[…].element.id’ is null or not an object” on the Sidebar Widgets page. I am using IE7. It doesn’t appear in Firefox. I am not alone. I found someone posted the same problem on wordpress.com. No one provided a solution.

Strictly speaking it is none issue because the script error seems doesn’t cause any functional problems. But I like everything looks perfect. So I provided a cover up of the error here. I don’t want to say it is a fix because I really don’t know what the code is supposed to do.

Here is the code in widgets.php that caused the error.


      for (var n in Draggables.drags){
            if (Draggables.drags[n].element.id == ‘lastmodule’){
                  Draggables.drags[n].destroy();
                  break;
            }
      }

The problem seems to be the variable “n” is not returning a number so when it is used as the subscript of an Array the Array returns nothing. In fact it also returns nothing on Firefox but interestingly Fireofox doesn’t report it as an error. So to cover it up I used “if (parseInt(n))” to wrap around the problem statement.


      for (var n in Draggables.drags){
            if (parseInt(n)) {
                  if (Draggables.drags[n].element.id == ‘lastmodule’){
                        Draggables.drags[n].destroy();
                        break;
                  }
            }
      }

It seems work. As I said I don’t really know how this piece of code interacts with others. If you don’t think that is a good practice or you have better idea please post.


Related Posts:

  • Why Microsoft Wants to Buy Yahoo - Because Microsoft Search Ranking Algorithm Have Serious Flaw
  • Setting up The Top 10 Best Plugins


  • 1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.5 out of 5)
    Loading ... Loading ...

    RSS feed | Trackback URI

    1 Comment »

    Comment by Ilja Subscribed to comments via email
    2007-03-04 17:06:41
    MyAvatars 0.2

    Hi,

    You’re right man…

    Thanks a lot! Your hint solved the bug!

    I think You cold help so many other desperate users, if you post your hint on whe Wordpress board or even better if you give ist to the Widget author.

    Thanks again!

    Ilja

     
    Name (required)
    E-mail (required - never shown publicly)
    URI
    Subscribe to comments via email
    Your Comment (smaller size | larger size)
    You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.