2009/07/01

Permission denied to get property HTMLDivElement.parentNode

pForm is cool, and I just used it to build a form yesterday. But it worked fine yesterday, but this morning, when I when tried to select the date from Date field, I got this error message:

Permission denied to get property HTMLDivElement.parentNode

pForm integrated the calendar.js developed by Dynarch.com, seems this is a bug of firefox . Here is a quick fix. Open calendar.js at line 131 in the code. Add try and catch like below,

Calendar.isRelated = function (el, evt) {
   var related = evt.relatedTarget;try{
   if (!related) {
      var type = evt.type;
      if (type == "mouseover") {
         related = evt.fromElement;
      } else if (type == "mouseout") {
         related = evt.toElement;
      }
   }
   while (related) {
      if (related == el) {
         return true;
      }
      related = related.parentNode;
   }
   return false;
   }catch(e){
      return;
   }
};

1 comment:

  1. I thought I'd just pop by with an update to this post:

    As noted at http://pastebin.com/f40a42703, the try, catch block should really go around this line:

    related = related.parentNode;

    So that is becomes:
    try {
    related = related.parentNode;
    } catch(e) {
    return false;
    }

    ReplyDelete