Patch to enable event.originalTarget on input fields. r=joki

This commit is contained in:
hyatt%netscape.com 2000-09-07 02:47:52 +00:00
parent 273809641f
commit cccbddadec
2 changed files with 22 additions and 2 deletions

View File

@ -799,6 +799,8 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
return NS_OK;
}
nsCOMPtr<nsIDOMEventTarget> oldTarget;
// Do not process any DOM events if the element is disabled
PRBool disabled;
nsresult rv = GetDisabled(&disabled);
@ -850,6 +852,14 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
return NS_ERROR_FAILURE;
}
(*aDOMEvent)->GetTarget(getter_AddRefs(oldTarget));
nsCOMPtr<nsIDOMEventTarget> originalTarget;
(*aDOMEvent)->GetOriginalTarget(getter_AddRefs(originalTarget));
if (!originalTarget) {
privateEvent->SetOriginalTarget(oldTarget);
}
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface((nsIDOMHTMLInputElement*)this);
privateEvent->SetTarget(target);
}
@ -911,7 +921,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
// This will reset the target to its original value
privateEvent->SetTarget(nsnull);
privateEvent->SetTarget(oldTarget);
}
}

View File

@ -799,6 +799,8 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
return NS_OK;
}
nsCOMPtr<nsIDOMEventTarget> oldTarget;
// Do not process any DOM events if the element is disabled
PRBool disabled;
nsresult rv = GetDisabled(&disabled);
@ -850,6 +852,14 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
return NS_ERROR_FAILURE;
}
(*aDOMEvent)->GetTarget(getter_AddRefs(oldTarget));
nsCOMPtr<nsIDOMEventTarget> originalTarget;
(*aDOMEvent)->GetOriginalTarget(getter_AddRefs(originalTarget));
if (!originalTarget) {
privateEvent->SetOriginalTarget(oldTarget);
}
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface((nsIDOMHTMLInputElement*)this);
privateEvent->SetTarget(target);
}
@ -911,7 +921,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
}
// This will reset the target to its original value
privateEvent->SetTarget(nsnull);
privateEvent->SetTarget(oldTarget);
}
}