зеркало из https://github.com/mozilla/pjs.git
Fixed Get/SetAttribute naming problem
This commit is contained in:
Родитель
6c895ae8a1
Коммит
0fe7ca5e0e
|
@ -38,9 +38,9 @@ public:
|
|||
|
||||
NS_IMETHOD GetTagName(nsString& aTagName)=0;
|
||||
|
||||
NS_IMETHOD GetDOMAttribute(const nsString& aName, nsString& aReturn)=0;
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn)=0;
|
||||
|
||||
NS_IMETHOD SetDOMAttribute(const nsString& aName, const nsString& aValue)=0;
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue)=0;
|
||||
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName)=0;
|
||||
|
||||
|
@ -58,8 +58,8 @@ public:
|
|||
|
||||
#define NS_DECL_IDOMELEMENT \
|
||||
NS_IMETHOD GetTagName(nsString& aTagName); \
|
||||
NS_IMETHOD GetDOMAttribute(const nsString& aName, nsString& aReturn); \
|
||||
NS_IMETHOD SetDOMAttribute(const nsString& aName, const nsString& aValue); \
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn); \
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue); \
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName); \
|
||||
NS_IMETHOD GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn); \
|
||||
NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn); \
|
||||
|
@ -71,8 +71,8 @@ public:
|
|||
|
||||
#define NS_FORWARD_IDOMELEMENT(_to) \
|
||||
NS_IMETHOD GetTagName(nsString& aTagName) { return _to##GetTagName(aTagName); } \
|
||||
NS_IMETHOD GetDOMAttribute(const nsString& aName, nsString& aReturn) { return _to##GetDOMAttribute(aName, aReturn); } \
|
||||
NS_IMETHOD SetDOMAttribute(const nsString& aName, const nsString& aValue) { return _to##SetDOMAttribute(aName, aValue); } \
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { return _to##GetAttribute(aName, aReturn); } \
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { return _to##SetAttribute(aName, aValue); } \
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName) { return _to##RemoveAttribute(aName); } \
|
||||
NS_IMETHOD GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn) { return _to##GetAttributeNode(aName, aReturn); } \
|
||||
NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return _to##SetAttributeNode(aNewAttr, aReturn); } \
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
|
||||
|
||||
readonly attribute DOMString tagName;
|
||||
DOMString getDOMAttribute(in DOMString name);
|
||||
void setDOMAttribute(in DOMString name,
|
||||
DOMString getAttribute(in DOMString name);
|
||||
void setAttribute(in DOMString name,
|
||||
in DOMString value)
|
||||
raises(DOMException);
|
||||
void removeAttribute(in DOMString name)
|
||||
|
|
|
@ -147,10 +147,10 @@ ResolveElement(JSContext *cx, JSObject *obj, jsval id)
|
|||
|
||||
|
||||
//
|
||||
// Native method GetDOMAttribute
|
||||
// Native method GetAttribute
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ElementGetDOMAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
ElementGetAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMElement *nativeThis = (nsIDOMElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
|
@ -168,14 +168,14 @@ ElementGetDOMAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
|
||||
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
|
||||
|
||||
if (NS_OK != nativeThis->GetDOMAttribute(b0, nativeRet)) {
|
||||
if (NS_OK != nativeThis->GetAttribute(b0, nativeRet)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
nsJSUtils::nsConvertStringToJSVal(nativeRet, cx, rval);
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function getDOMAttribute requires 1 parameters");
|
||||
JS_ReportError(cx, "Function getAttribute requires 1 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -184,10 +184,10 @@ ElementGetDOMAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
|
||||
|
||||
//
|
||||
// Native method SetDOMAttribute
|
||||
// Native method SetAttribute
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ElementSetDOMAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
ElementSetAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsIDOMElement *nativeThis = (nsIDOMElement*)JS_GetPrivate(cx, obj);
|
||||
JSBool rBool = JS_FALSE;
|
||||
|
@ -207,14 +207,14 @@ ElementSetDOMAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
|
||||
nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]);
|
||||
|
||||
if (NS_OK != nativeThis->SetDOMAttribute(b0, b1)) {
|
||||
if (NS_OK != nativeThis->SetAttribute(b0, b1)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*rval = JSVAL_VOID;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Function setDOMAttribute requires 2 parameters");
|
||||
JS_ReportError(cx, "Function setAttribute requires 2 parameters");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -484,8 +484,8 @@ static JSPropertySpec ElementProperties[] =
|
|||
//
|
||||
static JSFunctionSpec ElementMethods[] =
|
||||
{
|
||||
{"getAttribute", ElementGetDOMAttribute, 1},
|
||||
{"setAttribute", ElementSetDOMAttribute, 2},
|
||||
{"getAttribute", ElementGetAttribute, 1},
|
||||
{"setAttribute", ElementSetAttribute, 2},
|
||||
{"removeAttribute", ElementRemoveAttribute, 1},
|
||||
{"getAttributeNode", ElementGetAttributeNode, 1},
|
||||
{"setAttributeNode", ElementSetAttributeNode, 1},
|
||||
|
|
Загрузка…
Ссылка в новой задаче