rem: var element = Utils.getElementAt(elementId, this.context);  try { var checkbox = element.QueryInterface(Components.interfaces.nsIDOMHTMLInputElement); if (checkbox.type == "checkbox") { checkbox.checked = !checkbox.checked; Utils.fireHtmlEvent(this.context, checkbox, "change"); respond(this.context, "toggleElement"); return; } } catch(e) {}  try { var option = element.QueryInterface(Components.interfaces.nsIDOMHTMLOptionElement);   var select = option.parentNode; while (select && select.tagName != "SELECT") { select = select.parentNode; }  if (select && select.multiple) { option.selected = !option.selected; Utils.fireHtmlEvent(this.context, option, "change"); respond(this.context, "toggleElement"); return; } } catch(e) {}  respond(this.context, "toggleElement", "You may only toggle an element that is either a checkbox or an option in a select that allows multiple selections"); 
add: var element = Utils.getElementAt(elementId, this.context);  try { var checkbox = element.QueryInterface(Components.interfaces.nsIDOMHTMLInputElement); if (checkbox.type == "checkbox") { checkbox.checked = !checkbox.checked; Utils.fireHtmlEvent(this.context, checkbox, "change"); respond(this.context, "toggleElement"); return; } } catch(e) { }  try { var option = element.QueryInterface(Components.interfaces.nsIDOMHTMLOptionElement);   var select = option.parentNode; while (select && select.tagName != "SELECT") { select = select.parentNode; }  if (select && select.multiple) { option.selected = !option.selected; Utils.fireHtmlEvent(this.context, option, "change"); respond(this.context, "toggleElement"); return; } } catch(e) { }  respond(this.context, "toggleElement", "You may only toggle an element that is either a checkbox or an option in a select that allows multiple selections"); 
context: FirefoxDriver.prototype.toggleElement = function(respond, elementId) {	var element = Utils.getElementAt(elementId, this.context);		try {		var checkbox = element.QueryInterface(Components.interfaces.nsIDOMHTMLInputElement);		if (checkbox.type == "checkbox") {			checkbox.checked = !checkbox.checked;			Utils.fireHtmlEvent(this.context, checkbox, "change");			respond(this.context, "toggleElement");			return;		}	} catch(e) {}		try {		var option = element.QueryInterface(Components.interfaces.nsIDOMHTMLOptionElement);				// Find our containing select and see if it allows multiple selections		var select = option.parentNode;		while (select && select.tagName != "SELECT") {			select = select.parentNode;		}				if (select && select.multiple) {			option.selected = !option.selected;			Utils.fireHtmlEvent(this.context, option, "change");			respond(this.context, "toggleElement");			return;		}	} catch(e) {}		respond(this.context, "toggleElement", "You may only toggle an element that is either a checkbox or an option in a select that allows multiple selections");};
meta: 3428	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/3428/3d58fefd2379fe19ae5bc4540e46171c91481d00/wrappedElement.js/clean/firefox/src/extension/components/wrappedElement.js