Backout 270257.

This commit is contained in:
tor%cs.brown.edu 2004-12-12 05:30:29 +00:00
parent c072174d65
commit 66d32b786e
3 changed files with 24 additions and 5 deletions

View File

@ -212,7 +212,29 @@ nsSVGElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName, nsIAtom* aPrefix,
if (aNamespaceID == kNameSpaceID_None && IsEventName(aName)) {
nsCOMPtr<nsIEventListenerManager> manager;
GetListenerManager(getter_AddRefs(manager));
if (aName == nsSVGAtoms::onload) {
// If we have a document, and it has a script global, add the
// event listener on the global.
// Until we figure out how to handle multiple onloads, only
// onload on the root element (least surprise, hopefully).
// This test isn't ideal, as it's really checking for an
// empty document, which could happen with javascript DOM
// creation as well as for the root element of a document
// we're parsing. But in famous last words, this code will
// be changing soon to allow multiple onloads per document.
nsIDocument *document = GetCurrentDoc();
if (document && !document->GetRootContent()) {
nsCOMPtr<nsIDOMEventReceiver> receiver =
do_QueryInterface(document->GetScriptGlobalObject());
if (receiver) {
receiver->GetListenerManager(getter_AddRefs(manager));
}
}
}
else {
GetListenerManager(getter_AddRefs(manager));
}
if (manager) {
manager->AddScriptEventListener(NS_STATIC_CAST(nsIContent*, this), aName,
aValue, PR_TRUE);

View File

@ -341,6 +341,5 @@ nsSVGGraphicElement::IsAttributeMapped(const nsIAtom* name) const
PRBool
nsSVGGraphicElement::IsEventName(nsIAtom* aName)
{
return IsGraphicElementEventName(aName) ||
aName == nsSVGAtoms::onload;
return IsGraphicElementEventName(aName);
}

View File

@ -293,8 +293,6 @@ void
nsSVGScriptElement::GetScriptType(nsAString& type)
{
GetType(type);
if (type.LowerCaseEqualsLiteral("text/ecmascript"))
type.AssignLiteral("text/javascript");
}
// variation of this code in nsHTMLScriptElement - check if changes