Closed Bug 595429 Opened 14 years ago Closed 14 years ago

Add name IDL attribute for HTMLFieldSetElement

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b7

People

(Reporter: mounir, Assigned: mounir)

References

Details

(Keywords: dev-doc-complete, html5)

Attachments

(1 file)

fieldset.name should reflect the content attribute
Attached patch Patch v1Splinter Review
Very simple patch with strictly no risk for Gecko 2.0.
Attachment #474330 - Flags: review?(Olli.Pettay)
Attachment #474330 - Flags: approval2.0?
While you're here, could you make

 * For more information on this interface please see
 * http://www.w3.org/TR/DOM-Level-2-HTML/

refer to whatwg.org/html instead (if that's okay with Olli).
Yeah, could you update the comment to refer also to whatwg
Comment on attachment 474330 [details] [diff] [review]
Patch v1

># HG changeset patch
># Parent fa6c83c1a10e21259274a056cfec959542c2bfd6
># User Mounir Lamouri <mounir.lamouri@gmail.com>
># Date 1284182897 -7200
>Bug 595429 - Add name IDL attribute for HTMLFieldSetElement. r?=smaug
>
>diff --git a/content/html/content/src/nsHTMLFieldSetElement.cpp b/content/html/content/src/nsHTMLFieldSetElement.cpp
>--- a/content/html/content/src/nsHTMLFieldSetElement.cpp
>+++ b/content/html/content/src/nsHTMLFieldSetElement.cpp
>@@ -105,25 +105,24 @@ DOMCI_NODE_DATA(HTMLFieldSetElement, nsH
> NS_INTERFACE_TABLE_HEAD(nsHTMLFieldSetElement)
>   NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLFieldSetElement,
>                                    nsIDOMHTMLFieldSetElement,
>                                    nsIConstraintValidation)
>   NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLFieldSetElement,
>                                                nsGenericHTMLFormElement)
> NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFieldSetElement)
> 
>+NS_IMPL_ELEMENT_CLONE(nsHTMLFieldSetElement)
> 
>-// nsIDOMHTMLFieldSetElement
>+
>+NS_IMPL_STRING_ATTR(nsHTMLFieldSetElement, Name, name)
> 
> // nsIConstraintValidation
> NS_IMPL_NSICONSTRAINTVALIDATION(nsHTMLFieldSetElement)
> 
>-NS_IMPL_ELEMENT_CLONE(nsHTMLFieldSetElement)
>-
>-
> // nsIDOMHTMLFieldSetElement
> 
> NS_IMETHODIMP
> nsHTMLFieldSetElement::GetForm(nsIDOMHTMLFormElement** aForm)
> {
>   return nsGenericHTMLFormElement::GetForm(aForm);
> }
> 
>diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in
>--- a/content/html/content/test/Makefile.in
>+++ b/content/html/content/test/Makefile.in
>@@ -213,12 +213,13 @@ _TEST_FILES = \
> 		test_bug590353-2.html \
> 		test_bug593689.html \
> 		test_bug583288-1.html \
> 		test_bug583288-2.html \
> 		test_bug583288-3.html \
> 		583288_submit_server.sjs \
> 		583288_redirect_server.sjs \
> 		test_bug555840.html \
>+		test_bug595429.html \
> 		$(NULL)
> 
> libs:: $(_TEST_FILES)
> 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
>diff --git a/content/html/content/test/test_bug595429.html b/content/html/content/test/test_bug595429.html
>new file mode 100644
>--- /dev/null
>+++ b/content/html/content/test/test_bug595429.html
>@@ -0,0 +1,57 @@
>+<!DOCTYPE HTML>
>+<html>
>+<!--
>+https://bugzilla.mozilla.org/show_bug.cgi?id=595429
>+-->
>+<head>
>+  <title>Test for Bug 595429</title>
>+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
>+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
>+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
>+</head>
>+<body>
>+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=595429">Mozilla Bug 595429</a>
>+<p id="display"></p>
>+<pre id="test">
>+<script type="application/javascript">
>+
>+/** Test for Bug 595429 **/
>+
>+var fieldset = document.createElement("fieldset");
>+
>+ok("name" in fieldset, "<fieldset> should have a name IDL attribute");
>+
>+var testData = [
>+  "",
>+  " ",
>+  "foo",
>+  "foo bar",
>+];
>+
>+is(fieldset.getAttribute("name"), null,
>+   "By default, name content attribute should be null");
>+is(fieldset.name, "",
>+   "By default, name IDL attribute should be the empty string");
>+
>+for each(var data in testData) {
>+  fieldset.setAttribute("name", data);
>+  is(fieldset.getAttribute("name"), data,
>+     "name content attribute should be " + data);
>+  is(fieldset.name, data, "name IDL attribute should be " + data);
>+
>+  fieldset.setAttribute("name", "");
>+  fieldset.name = data;
>+  is(fieldset.getAttribute("name"), data,
>+     "name content attribute should be " + data);
>+  is(fieldset.name, data, "name IDL attribute should be " + data);
>+}
>+
>+fieldset.removeAttribute("name");
>+is(fieldset.getAttribute("name"), null,
>+   "name content attribute should be null");
>+is(fieldset.name, "", "name IDL attribute should be the empty string");
>+
>+</script>
>+</pre>
>+</body>
>+</html>
>diff --git a/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl
>--- a/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl
>+++ b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl
>@@ -44,20 +44,22 @@
>  * [X]HTML fieldset element.
>  *
>  * For more information on this interface please see
>  * http://www.w3.org/TR/DOM-Level-2-HTML/
>  */
> 
> interface nsIDOMValidityState;
> 
>-[scriptable, uuid(eb1c3ff1-e81f-4ade-8ec8-4e8acc592edf)]
>+[scriptable, uuid(7d66ab6c-61fb-459f-8e3b-f8bd67991786)]
> interface nsIDOMHTMLFieldSetElement : nsIDOMHTMLElement
> {
>   readonly attribute nsIDOMHTMLFormElement  form;
>+           attribute DOMString              name;
>+
> 
>   // The following lines are parte of the constraint validation API, see:
>   // http://dev.w3.org/html5/spec/forms.html#the-constraint-validation-api
>   readonly attribute boolean               willValidate;
>   readonly attribute nsIDOMValidityState   validity;
>   readonly attribute DOMString             validationMessage;
>   boolean checkValidity();
>   void setCustomValidity(in DOMString error);
Attachment #474330 - Flags: review?(Olli.Pettay) → review+
(In reply to comment #3)
> Yeah, could you update the comment to refer also to whatwg

I think we should open a bug and have this changed for all (or mostly all) idl in dom/interfaces/html. Will open it.
Sounds good.
Done: bug 596311
Johnny, can I get your a+ on that?
Pushed:
http://hg.mozilla.org/mozilla-central/rev/9405497abe4e
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b7
Attachment #474330 - Flags: approval2.0?
Depends on: 671221
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: