Fix for bug 108666: No context menu when right clicking on form text widgets

getAttribute() now returns a null object instead of an empty string
  when an attribute does not exist, so expand shortcuts like
  getAttribute().toUpperCase() to the longer form to prevent errors.

r=blakeross@telocity.com  sr=jst@netscape.com
This commit is contained in:
kin%netscape.com 2001-11-14 23:56:42 +00:00
parent d052c8c9f8
commit 4a0c83cb31

View File

@ -257,7 +257,8 @@ nsContextMenu.prototype = {
// URL must be constructed.
this.imageURL = this.objectImageURL( this.target );
} else if ( this.target.localName.toUpperCase() == "INPUT") {
if(this.target.getAttribute( "type" ).toUpperCase() == "IMAGE") {
var type = this.target.getAttribute("type");
if(type && type.toUpperCase() == "IMAGE") {
this.onImage = true;
// Convert src attribute to absolute URL.
this.imageURL = this.makeURLAbsolute( this.target.baseURI,
@ -731,7 +732,12 @@ nsContextMenu.prototype = {
return false;
if (node.localName.toUpperCase() == "INPUT") {
var attrib = node.getAttribute("type").toUpperCase();
var attrib = "";
var type = node.getAttribute("type");
if (type)
attrib = type.toUpperCase();
return( (attrib != "IMAGE") &&
(attrib != "PASSWORD") &&
(attrib != "CHECKBOX") &&