This commit is contained in:
joki%netscape.com 1998-11-02 23:05:46 +00:00
Родитель 7262fe194b
Коммит fa7cb8280b
19 изменённых файлов: 111 добавлений и 65 удалений

Просмотреть файл

@ -1064,7 +1064,7 @@ PRBool nsDocument::SetProperty(JSContext *aContext, jsval aID, jsval *aVp)
}
}
}
else if (mPropName == "onsubmit" || mPropName == "onreset") {
else if (mPropName == "onsubmit" || mPropName == "onreset" || mPropName == "onchange") {
if (NS_OK == GetListenerManager(&mManager)) {
nsIScriptContext *mScriptCX = (nsIScriptContext *)JS_GetContextPrivate(aContext);
if (NS_OK != mManager->RegisterScriptEventListener(mScriptCX, this, kIDOMFormListenerIID)) {

Просмотреть файл

@ -31,7 +31,7 @@ static char* mEventNames[] = {
"onmousedown", "onmouseup", "onclick", "ondblclick", "onmouseover",
"onmouseout", "onmousemove", "onkeydown", "onkeyup", "onkeypress",
"onfocus", "onblur", "onload", "onunload", "onabort", "onerror",
"onsubmit", "onreset", "onpaint"
"onsubmit", "onreset", "onchange", "onpaint"
};
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
@ -337,6 +337,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return mEventNames[eDOMEvents_submit];
case NS_FORM_RESET:
return mEventNames[eDOMEvents_reset];
case NS_FORM_CHANGE:
return mEventNames[eDOMEvents_change];
case NS_PAINT:
return mEventNames[eDOMEvents_paint];
default:

Просмотреть файл

@ -58,6 +58,7 @@ public:
eDOMEvents_error,
eDOMEvents_submit,
eDOMEvents_reset,
eDOMEvents_change,
eDOMEvents_paint
};

Просмотреть файл

@ -428,6 +428,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_FORM_SUBMIT:
case NS_FORM_RESET:
case NS_FORM_CHANGE:
if (nsnull != mFormListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMEvent(aDOMEvent, aPresContext, aEvent);
@ -447,6 +448,9 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_FORM_RESET:
ret = mFormListener->Reset(*aDOMEvent);
break;
case NS_FORM_CHANGE:
ret = mFormListener->Change(*aDOMEvent);
break;
default:
break;
}

Просмотреть файл

@ -1345,38 +1345,32 @@ nsGenericHTMLElement::SetAttribute(nsIAtom* aAttribute,
}
else {
// Check for event handlers
if (nsHTMLAtoms::onclick == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onclick, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::ondblclick == aAttribute)
AddScriptEventListener(nsHTMLAtoms::ondblclick, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onmousedown == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmousedown, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onmouseup == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmouseup, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onmouseover == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmouseover, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onmouseout == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmouseout, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onkeydown == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onkeydown, aValue, kIDOMKeyListenerIID);
else if (nsHTMLAtoms::onkeyup == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onkeyup, aValue, kIDOMKeyListenerIID);
else if (nsHTMLAtoms::onkeypress == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onkeypress, aValue, kIDOMKeyListenerIID);
if ((nsHTMLAtoms::onclick == aAttribute) ||
(nsHTMLAtoms::ondblclick == aAttribute) ||
(nsHTMLAtoms::onmousedown == aAttribute) ||
(nsHTMLAtoms::onmouseup == aAttribute) ||
(nsHTMLAtoms::onmouseover == aAttribute) ||
(nsHTMLAtoms::onmouseout == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMMouseListenerIID);
else if ((nsHTMLAtoms::onkeydown == aAttribute) ||
(nsHTMLAtoms::onkeyup == aAttribute) ||
(nsHTMLAtoms::onkeypress == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMKeyListenerIID);
else if (nsHTMLAtoms::onmousemove == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmousemove, aValue, kIDOMMouseMotionListenerIID);
AddScriptEventListener(aAttribute, aValue, kIDOMMouseMotionListenerIID);
else if (nsHTMLAtoms::onload == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onload, aValue, kIDOMLoadListenerIID);
else if (nsHTMLAtoms::onunload == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onunload, aValue, kIDOMLoadListenerIID);
else if (nsHTMLAtoms::onabort == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onabort, aValue, kIDOMLoadListenerIID);
else if (nsHTMLAtoms::onerror == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onerror, aValue, kIDOMLoadListenerIID);
else if (nsHTMLAtoms::onfocus == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onfocus, aValue, kIDOMFocusListenerIID);
else if (nsHTMLAtoms::onblur == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onblur, aValue, kIDOMFocusListenerIID);
else if ((nsHTMLAtoms::onunload == aAttribute) ||
(nsHTMLAtoms::onabort == aAttribute) ||
(nsHTMLAtoms::onerror == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMLoadListenerIID);
else if ((nsHTMLAtoms::onfocus == aAttribute) ||
(nsHTMLAtoms::onblur == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMFocusListenerIID);
else if ((nsHTMLAtoms::onsubmit == aAttribute) ||
(nsHTMLAtoms::onreset == aAttribute) ||
(nsHTMLAtoms::onchange == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMFormListenerIID);
else if (nsHTMLAtoms::onpaint == aAttribute)
AddScriptEventListener(aAttribute, aValue, kIDOMPaintListenerIID);
@ -2041,7 +2035,7 @@ nsGenericHTMLElement::SetProperty(JSContext *aContext, jsval aID, jsval *aVp)
}
}
}
else if (propName == "onsubmit" || propName == "onreset") {
else if (propName == "onsubmit" || propName == "onreset" || propName == "onchange") {
if (NS_OK == GetListenerManager(&manager)) {
nsIScriptContext *mScriptCX = (nsIScriptContext *)JS_GetContextPrivate(aContext);
if (NS_OK != manager->RegisterScriptEventListener(mScriptCX, owner, kIDOMFormListenerIID)) {

Просмотреть файл

@ -148,6 +148,7 @@ nsIAtom* nsHTMLAtoms::object;
nsIAtom* nsHTMLAtoms::ol;
nsIAtom* nsHTMLAtoms::onabort;
nsIAtom* nsHTMLAtoms::onblur;
nsIAtom* nsHTMLAtoms::onchange;
nsIAtom* nsHTMLAtoms::onclick;
nsIAtom* nsHTMLAtoms::ondblclick;
nsIAtom* nsHTMLAtoms::ondragdrop;
@ -163,6 +164,8 @@ nsIAtom* nsHTMLAtoms::onmouseover;
nsIAtom* nsHTMLAtoms::onmouseout;
nsIAtom* nsHTMLAtoms::onmouseup;
nsIAtom* nsHTMLAtoms::onpaint;
nsIAtom* nsHTMLAtoms::onreset;
nsIAtom* nsHTMLAtoms::onsubmit;
nsIAtom* nsHTMLAtoms::onunload;
nsIAtom* nsHTMLAtoms::outOfDate;
nsIAtom* nsHTMLAtoms::overflow;
@ -367,6 +370,7 @@ void nsHTMLAtoms::AddrefAtoms()
ol = NS_NewAtom("OL");
onabort = NS_NewAtom("ONABORT");
onblur = NS_NewAtom("ONBLUR");
onchange = NS_NewAtom("ONCHANGE");
onclick = NS_NewAtom("ONCLICK");
ondragdrop = NS_NewAtom("ONDBLCLICK");
ondragdrop = NS_NewAtom("ONDRAGDROP");
@ -382,6 +386,8 @@ void nsHTMLAtoms::AddrefAtoms()
onmouseout = NS_NewAtom("ONMOUSEOUT");
onmouseup = NS_NewAtom("ONMOUSEUP");
onpaint = NS_NewAtom("ONPAINT");
onreset = NS_NewAtom("ONRESET");
onsubmit = NS_NewAtom("ONSUBMIT");
onunload = NS_NewAtom("ONUNLOAD");
outOfDate = NS_NewAtom("OUT-OF-DATE");
overflow = NS_NewAtom("OVERFLOW");
@ -581,6 +587,7 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(ol);
NS_RELEASE(onabort);
NS_RELEASE(onblur);
NS_RELEASE(onchange);
NS_RELEASE(onclick);
NS_RELEASE(ondblclick);
NS_RELEASE(ondragdrop);
@ -596,6 +603,8 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(onmouseout);
NS_RELEASE(onmouseup);
NS_RELEASE(onpaint);
NS_RELEASE(onreset);
NS_RELEASE(onsubmit);
NS_RELEASE(onunload);
NS_RELEASE(outOfDate);
NS_RELEASE(overflow);

Просмотреть файл

@ -179,6 +179,7 @@ public:
static nsIAtom* ol;
static nsIAtom* onabort;
static nsIAtom* onblur;
static nsIAtom* onchange;
static nsIAtom* onclick;
static nsIAtom* ondblclick;
static nsIAtom* ondragdrop;
@ -194,6 +195,8 @@ public:
static nsIAtom* onmouseout;
static nsIAtom* onmouseup;
static nsIAtom* onpaint;
static nsIAtom* onreset;
static nsIAtom* onsubmit;
static nsIAtom* onunload;
static nsIAtom* outOfDate;
static nsIAtom* overflow;

Просмотреть файл

@ -179,6 +179,7 @@ public:
static nsIAtom* ol;
static nsIAtom* onabort;
static nsIAtom* onblur;
static nsIAtom* onchange;
static nsIAtom* onclick;
static nsIAtom* ondblclick;
static nsIAtom* ondragdrop;
@ -194,6 +195,8 @@ public:
static nsIAtom* onmouseout;
static nsIAtom* onmouseup;
static nsIAtom* onpaint;
static nsIAtom* onreset;
static nsIAtom* onsubmit;
static nsIAtom* onunload;
static nsIAtom* outOfDate;
static nsIAtom* overflow;

Просмотреть файл

@ -148,6 +148,7 @@ nsIAtom* nsHTMLAtoms::object;
nsIAtom* nsHTMLAtoms::ol;
nsIAtom* nsHTMLAtoms::onabort;
nsIAtom* nsHTMLAtoms::onblur;
nsIAtom* nsHTMLAtoms::onchange;
nsIAtom* nsHTMLAtoms::onclick;
nsIAtom* nsHTMLAtoms::ondblclick;
nsIAtom* nsHTMLAtoms::ondragdrop;
@ -163,6 +164,8 @@ nsIAtom* nsHTMLAtoms::onmouseover;
nsIAtom* nsHTMLAtoms::onmouseout;
nsIAtom* nsHTMLAtoms::onmouseup;
nsIAtom* nsHTMLAtoms::onpaint;
nsIAtom* nsHTMLAtoms::onreset;
nsIAtom* nsHTMLAtoms::onsubmit;
nsIAtom* nsHTMLAtoms::onunload;
nsIAtom* nsHTMLAtoms::outOfDate;
nsIAtom* nsHTMLAtoms::overflow;
@ -367,6 +370,7 @@ void nsHTMLAtoms::AddrefAtoms()
ol = NS_NewAtom("OL");
onabort = NS_NewAtom("ONABORT");
onblur = NS_NewAtom("ONBLUR");
onchange = NS_NewAtom("ONCHANGE");
onclick = NS_NewAtom("ONCLICK");
ondragdrop = NS_NewAtom("ONDBLCLICK");
ondragdrop = NS_NewAtom("ONDRAGDROP");
@ -382,6 +386,8 @@ void nsHTMLAtoms::AddrefAtoms()
onmouseout = NS_NewAtom("ONMOUSEOUT");
onmouseup = NS_NewAtom("ONMOUSEUP");
onpaint = NS_NewAtom("ONPAINT");
onreset = NS_NewAtom("ONRESET");
onsubmit = NS_NewAtom("ONSUBMIT");
onunload = NS_NewAtom("ONUNLOAD");
outOfDate = NS_NewAtom("OUT-OF-DATE");
overflow = NS_NewAtom("OVERFLOW");
@ -581,6 +587,7 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(ol);
NS_RELEASE(onabort);
NS_RELEASE(onblur);
NS_RELEASE(onchange);
NS_RELEASE(onclick);
NS_RELEASE(ondblclick);
NS_RELEASE(ondragdrop);
@ -596,6 +603,8 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(onmouseout);
NS_RELEASE(onmouseup);
NS_RELEASE(onpaint);
NS_RELEASE(onreset);
NS_RELEASE(onsubmit);
NS_RELEASE(onunload);
NS_RELEASE(outOfDate);
NS_RELEASE(overflow);

Просмотреть файл

@ -50,6 +50,13 @@ public:
*/
virtual nsresult Reset(nsIDOMEvent* aEvent) = 0;
/**
* Processes a form change event
* @param aEvent @see nsIDOMEvent.h
* @returns whether the event was consumed or ignored. @see nsresult
*/
virtual nsresult Change(nsIDOMEvent* aEvent) = 0;
};
#endif // nsIDOMFormListener_h__

Просмотреть файл

@ -1505,7 +1505,7 @@ GlobalWindowImpl::CheckForEventListener(JSContext *aContext, nsString& aPropName
}
}
}
else if (aPropName == "onsubmit" || aPropName == "onreset") {
else if (aPropName == "onsubmit" || aPropName == "onreset" || aPropName == "onchange") {
if (NS_OK == GetListenerManager(&mManager)) {
nsIScriptContext *mScriptCX = (nsIScriptContext *)JS_GetContextPrivate(aContext);
if (NS_OK != mManager->RegisterScriptEventListener(mScriptCX, this, kIDOMFormListenerIID)) {

Просмотреть файл

@ -1064,7 +1064,7 @@ PRBool nsDocument::SetProperty(JSContext *aContext, jsval aID, jsval *aVp)
}
}
}
else if (mPropName == "onsubmit" || mPropName == "onreset") {
else if (mPropName == "onsubmit" || mPropName == "onreset" || mPropName == "onchange") {
if (NS_OK == GetListenerManager(&mManager)) {
nsIScriptContext *mScriptCX = (nsIScriptContext *)JS_GetContextPrivate(aContext);
if (NS_OK != mManager->RegisterScriptEventListener(mScriptCX, this, kIDOMFormListenerIID)) {

Просмотреть файл

@ -31,7 +31,7 @@ static char* mEventNames[] = {
"onmousedown", "onmouseup", "onclick", "ondblclick", "onmouseover",
"onmouseout", "onmousemove", "onkeydown", "onkeyup", "onkeypress",
"onfocus", "onblur", "onload", "onunload", "onabort", "onerror",
"onsubmit", "onreset", "onpaint"
"onsubmit", "onreset", "onchange", "onpaint"
};
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
@ -337,6 +337,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return mEventNames[eDOMEvents_submit];
case NS_FORM_RESET:
return mEventNames[eDOMEvents_reset];
case NS_FORM_CHANGE:
return mEventNames[eDOMEvents_change];
case NS_PAINT:
return mEventNames[eDOMEvents_paint];
default:

Просмотреть файл

@ -58,6 +58,7 @@ public:
eDOMEvents_error,
eDOMEvents_submit,
eDOMEvents_reset,
eDOMEvents_change,
eDOMEvents_paint
};

Просмотреть файл

@ -428,6 +428,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_FORM_SUBMIT:
case NS_FORM_RESET:
case NS_FORM_CHANGE:
if (nsnull != mFormListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMEvent(aDOMEvent, aPresContext, aEvent);
@ -447,6 +448,9 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_FORM_RESET:
ret = mFormListener->Reset(*aDOMEvent);
break;
case NS_FORM_CHANGE:
ret = mFormListener->Change(*aDOMEvent);
break;
default:
break;
}

Просмотреть файл

@ -148,6 +148,7 @@ nsIAtom* nsHTMLAtoms::object;
nsIAtom* nsHTMLAtoms::ol;
nsIAtom* nsHTMLAtoms::onabort;
nsIAtom* nsHTMLAtoms::onblur;
nsIAtom* nsHTMLAtoms::onchange;
nsIAtom* nsHTMLAtoms::onclick;
nsIAtom* nsHTMLAtoms::ondblclick;
nsIAtom* nsHTMLAtoms::ondragdrop;
@ -163,6 +164,8 @@ nsIAtom* nsHTMLAtoms::onmouseover;
nsIAtom* nsHTMLAtoms::onmouseout;
nsIAtom* nsHTMLAtoms::onmouseup;
nsIAtom* nsHTMLAtoms::onpaint;
nsIAtom* nsHTMLAtoms::onreset;
nsIAtom* nsHTMLAtoms::onsubmit;
nsIAtom* nsHTMLAtoms::onunload;
nsIAtom* nsHTMLAtoms::outOfDate;
nsIAtom* nsHTMLAtoms::overflow;
@ -367,6 +370,7 @@ void nsHTMLAtoms::AddrefAtoms()
ol = NS_NewAtom("OL");
onabort = NS_NewAtom("ONABORT");
onblur = NS_NewAtom("ONBLUR");
onchange = NS_NewAtom("ONCHANGE");
onclick = NS_NewAtom("ONCLICK");
ondragdrop = NS_NewAtom("ONDBLCLICK");
ondragdrop = NS_NewAtom("ONDRAGDROP");
@ -382,6 +386,8 @@ void nsHTMLAtoms::AddrefAtoms()
onmouseout = NS_NewAtom("ONMOUSEOUT");
onmouseup = NS_NewAtom("ONMOUSEUP");
onpaint = NS_NewAtom("ONPAINT");
onreset = NS_NewAtom("ONRESET");
onsubmit = NS_NewAtom("ONSUBMIT");
onunload = NS_NewAtom("ONUNLOAD");
outOfDate = NS_NewAtom("OUT-OF-DATE");
overflow = NS_NewAtom("OVERFLOW");
@ -581,6 +587,7 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(ol);
NS_RELEASE(onabort);
NS_RELEASE(onblur);
NS_RELEASE(onchange);
NS_RELEASE(onclick);
NS_RELEASE(ondblclick);
NS_RELEASE(ondragdrop);
@ -596,6 +603,8 @@ void nsHTMLAtoms::ReleaseAtoms()
NS_RELEASE(onmouseout);
NS_RELEASE(onmouseup);
NS_RELEASE(onpaint);
NS_RELEASE(onreset);
NS_RELEASE(onsubmit);
NS_RELEASE(onunload);
NS_RELEASE(outOfDate);
NS_RELEASE(overflow);

Просмотреть файл

@ -179,6 +179,7 @@ public:
static nsIAtom* ol;
static nsIAtom* onabort;
static nsIAtom* onblur;
static nsIAtom* onchange;
static nsIAtom* onclick;
static nsIAtom* ondblclick;
static nsIAtom* ondragdrop;
@ -194,6 +195,8 @@ public:
static nsIAtom* onmouseout;
static nsIAtom* onmouseup;
static nsIAtom* onpaint;
static nsIAtom* onreset;
static nsIAtom* onsubmit;
static nsIAtom* onunload;
static nsIAtom* outOfDate;
static nsIAtom* overflow;

Просмотреть файл

@ -1345,38 +1345,32 @@ nsGenericHTMLElement::SetAttribute(nsIAtom* aAttribute,
}
else {
// Check for event handlers
if (nsHTMLAtoms::onclick == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onclick, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::ondblclick == aAttribute)
AddScriptEventListener(nsHTMLAtoms::ondblclick, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onmousedown == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmousedown, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onmouseup == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmouseup, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onmouseover == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmouseover, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onmouseout == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmouseout, aValue, kIDOMMouseListenerIID);
else if (nsHTMLAtoms::onkeydown == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onkeydown, aValue, kIDOMKeyListenerIID);
else if (nsHTMLAtoms::onkeyup == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onkeyup, aValue, kIDOMKeyListenerIID);
else if (nsHTMLAtoms::onkeypress == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onkeypress, aValue, kIDOMKeyListenerIID);
if ((nsHTMLAtoms::onclick == aAttribute) ||
(nsHTMLAtoms::ondblclick == aAttribute) ||
(nsHTMLAtoms::onmousedown == aAttribute) ||
(nsHTMLAtoms::onmouseup == aAttribute) ||
(nsHTMLAtoms::onmouseover == aAttribute) ||
(nsHTMLAtoms::onmouseout == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMMouseListenerIID);
else if ((nsHTMLAtoms::onkeydown == aAttribute) ||
(nsHTMLAtoms::onkeyup == aAttribute) ||
(nsHTMLAtoms::onkeypress == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMKeyListenerIID);
else if (nsHTMLAtoms::onmousemove == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onmousemove, aValue, kIDOMMouseMotionListenerIID);
AddScriptEventListener(aAttribute, aValue, kIDOMMouseMotionListenerIID);
else if (nsHTMLAtoms::onload == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onload, aValue, kIDOMLoadListenerIID);
else if (nsHTMLAtoms::onunload == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onunload, aValue, kIDOMLoadListenerIID);
else if (nsHTMLAtoms::onabort == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onabort, aValue, kIDOMLoadListenerIID);
else if (nsHTMLAtoms::onerror == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onerror, aValue, kIDOMLoadListenerIID);
else if (nsHTMLAtoms::onfocus == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onfocus, aValue, kIDOMFocusListenerIID);
else if (nsHTMLAtoms::onblur == aAttribute)
AddScriptEventListener(nsHTMLAtoms::onblur, aValue, kIDOMFocusListenerIID);
else if ((nsHTMLAtoms::onunload == aAttribute) ||
(nsHTMLAtoms::onabort == aAttribute) ||
(nsHTMLAtoms::onerror == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMLoadListenerIID);
else if ((nsHTMLAtoms::onfocus == aAttribute) ||
(nsHTMLAtoms::onblur == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMFocusListenerIID);
else if ((nsHTMLAtoms::onsubmit == aAttribute) ||
(nsHTMLAtoms::onreset == aAttribute) ||
(nsHTMLAtoms::onchange == aAttribute))
AddScriptEventListener(aAttribute, aValue, kIDOMFormListenerIID);
else if (nsHTMLAtoms::onpaint == aAttribute)
AddScriptEventListener(aAttribute, aValue, kIDOMPaintListenerIID);
@ -2041,7 +2035,7 @@ nsGenericHTMLElement::SetProperty(JSContext *aContext, jsval aID, jsval *aVp)
}
}
}
else if (propName == "onsubmit" || propName == "onreset") {
else if (propName == "onsubmit" || propName == "onreset" || propName == "onchange") {
if (NS_OK == GetListenerManager(&manager)) {
nsIScriptContext *mScriptCX = (nsIScriptContext *)JS_GetContextPrivate(aContext);
if (NS_OK != manager->RegisterScriptEventListener(mScriptCX, owner, kIDOMFormListenerIID)) {

Просмотреть файл

@ -229,6 +229,7 @@ struct nsMenuEvent : public nsGUIEvent {
#define NS_FORM_EVENT_START 1200
#define NS_FORM_SUBMIT (NS_FORM_EVENT_START)
#define NS_FORM_RESET (NS_FORM_EVENT_START + 1)
#define NS_FORM_CHANGE (NS_FORM_EVENT_START + 2)
//@}