Closed Bug 1419316 Opened 7 years ago Closed 7 years ago

Setting HTMLOutputElement.defaultValue makes it being reset to "" when it has childs and in default mode

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: jdai, Assigned: jdai)

Details

Attachments

(1 file, 2 obsolete files)

Priority: -- → P2
Assignee: nobody → jdai
Comment on attachment 8931255 [details] [diff] [review]
Fix defaultValue on HTMLOutputElement must enqueue disconnectedCallback when removing a custom element. r=smaug

Yeah, I think Reset has similar issue.
And please add some comment why mDefaultValue can't be passed. It is very much non-obvious. Had to look at the mutation observing methods.

Feel free to fix Reset (+ add a test) if needed in a separate bug.
Attachment #8931255 - Flags: review?(bugs) → review+
We do enqueue disconnectedCallback for the removed custom element, this bug is more about the setting HTMLOutputElement.defaultValue is not handled correct.
No longer blocks: 1419295
Summary: DefaultValue on HTMLOutputElement must enqueue disconnectedCallback when removing a custom element → Setting HTMLOutputElement.defaultValue makes it being reset to "" when it has childs and in default mode
yeah, which is why reviewing took a bit time. Had to realize this isn't a custom element issue at all.
(In reply to Edgar Chen [:edgar] from comment #3)
> I am curious if we have some problem in
> https://searchfox.org/mozilla-central/rev/
> 33c90c196bc405e628bc868a4f4ba29b992478c0/dom/html/HTMLOutputElement.cpp#62?

It will not have similar issue, because per spec of reset algorithm[1] for output elements is to set the element's value mode flag to default and then to set the element's textContent IDL attribute to the value of the element's default value (thus replacing the element's child nodes). Therefore, the text node for default value should keep it and remove the element's child nodes.

[1] https://html.spec.whatwg.org/#the-output-element:concept-form-reset-control


(In reply to Olli Pettay [:smaug] (ni?s and f?s processed after r?s) from comment #4)
> Comment on attachment 8931255 [details] [diff] [review]
> Fix defaultValue on HTMLOutputElement must enqueue disconnectedCallback when
> removing a custom element. r=smaug
> 
> Yeah, I think Reset has similar issue.
> And please add some comment why mDefaultValue can't be passed. It is very
> much non-obvious. Had to look at the mutation observing methods.
> 
> Feel free to fix Reset (+ add a test) if needed in a separate bug.

I will add a reset testcase that also enqueue disconnectedCallback when removing a custom element. Thank you.
(In reply to John Dai[:jdai] from comment #7)
> It will not have similar issue

Spec has no problem with the reset algorithm, but our implementation has.
Consider this test: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5597
The defaultValue is set to "" after reset steps in our implementation.
(In reply to Edgar Chen [:edgar] from comment #8)
> (In reply to John Dai[:jdai] from comment #7)
> > It will not have similar issue
> 
> Spec has no problem with the reset algorithm, but our implementation has.
> Consider this test:
> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5597
> The defaultValue is set to "" after reset steps in our implementation.

I file bug 1422260 for this. Thank you.
Keywords: checkin-needed
Pushed by ncsoregi@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/63747de53588
Fix setting HTMLOutputElement.defaultValue makes it being reset to empty string when it has childs and in default mode. r=smaug
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/63747de53588
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: