Closed
Bug 668820
Opened 14 years ago
Closed 14 years ago
Improve how we pass arguments to reflects.js methods
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla8
People
(Reporter: mounir, Assigned: mounir)
References
Details
Attachments
(1 file)
28.68 KB,
patch
|
Ms2ger
:
review+
|
Details | Diff | Splinter Review |
I mean, I think it's an improvement because it seems clearer.
Attachment #543443 -
Flags: review?(Ms2ger)
Comment 1•14 years ago
|
||
Comment on attachment 543443 [details] [diff] [review]
Patch v1
I'm not a big fan of this pattern, but it does look like an improvement here.
>--- a/content/html/content/test/reflect.js
>+++ b/content/html/content/test/reflect.js
> /**
> * Checks that a given attribute is correctly reflected as a string.
> *
>- * @param aElement Element node to test
>- * @param aAttr String name of the attribute
>- * @param aOtherValues Array other values to test in addition of the default ones [optional]
>+ * @param aParameters Object object containing the parameters, which are:
>+ * - element Element node to test
>+ * - attribute String name of the attribute
>+ * - otherValues Array [optional] other values to test in addition of the default ones
> */
Here and elsewhere, the indentation seems random.
>-function reflectString(aElement, aAttr, aOtherValues)
>+function reflectString(aParameters) //aElement, aAttr, aOtherValues)
Get rid of the comment.
> // Tests when the attribute isn't set.
>- is(aElement.getAttribute(aAttr), null,
>+ is(element.getAttribute(attr), null,
> "When not set, the content attribute should be undefined.");
null
>- is(aElement[aAttr], "",
>+ is(element[attr], "",
> "When not set, the IDL attribute should return the empty string");
>
> /**
> * TODO: as long as null stringification doesn't fallow the webidl specs,
"follow the WebIDL specification"
>
> // Tests after removeAttribute() is called. Should be equivalent with not set.
>- is(aElement.getAttribute(aAttr), null,
>+ is(element.getAttribute(attr), null,
> "When not set, the content attribute should be undefined.");
And here
>-function reflectUnsignedInt(aElement, aAttr, aNonNull, aDefault)
>+function reflectUnsignedInt(aParameters)
> {
>- ok(aAttr in aElement, aAttr + " should be an IDL attribute of this element");
>- is(typeof aElement[aAttr], "number", aAttr + " IDL attribute should be a string");
>+ ok(attr in element, attr + " should be an IDL attribute of this element");
>+ is(typeof element[attr], "number", attr + " IDL attribute should be a string");
... a number
And s/nonNull/nonZero/ everywhere.
r=me
Attachment #543443 -
Flags: review?(Ms2ger) → review+
Assignee | ||
Updated•14 years ago
|
Flags: in-testsuite+
Whiteboard: [needs review] → [inbound]
Assignee | ||
Comment 2•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
You need to log in
before you can comment on or make changes to this bug.
Description
•