cloneNode(true) does not clone value of select
Reported by
bes.inte...@gmail.com,
May 2 2018
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.45 Safari/537.36 OPR/53.0.2907.7 (Edition beta) Steps to reproduce the problem: testcase https://codepen.io/anon/pen/bMWKdO What is the expected behavior? What went wrong? clonned node must keep DOM state Did this work before? No Chrome version: 66.0.3359.45 Channel: n/a OS Version: Flash Version: Shockwave Flash 29.0 r0
,
May 3 2018
,
May 3 2018
The specification doesn't say the state should be cloned: https://dom.spec.whatwg.org/#concept-node-clone
,
May 3 2018
The standard in this place is vague. But now browsers (really all) is copying the state of radio buttons and checkboxes. It is logical to bring everything to a consistent form. Spec discussion https://stackoverflow.com/questions/27193301/node-clonenode-inconsistent-with-dom-spec Refer to spec in step 3 you must copy Attr. But actual you copy properties (opposed to attributes) of input type=text, checked of radio. Copy "selected" properties of select's option.
,
May 3 2018
Step 3 is for the case when the processed node is not an element, but since the internal state is never exposed as an attribute (it's a technical term defined in the same spec and in your case only 'name' and 'onchange' are attributes) as per DOM spec, that step is not applicable here and Chrome matches the current spec. You, or someone else, can/should open an issue in the spec's repo to clarify cloning of the internal state - https://github.com/whatwg/dom
,
May 4 2018
Yes you are right. Spec defines cloning steps only for script and input elements. I was told there https://github.com/whatwg/dom/issues/644 that the spec is a conservative thing to correct mistakes in it. Maybe this can be done through implementation?
,
Jul 20
Closing according to the conclusion of https://github.com/whatwg/dom/issues/644 |
|||
►
Sign in to add a comment |
|||
Comment 1 by raphael....@intel.com
, May 2 2018Labels: -OS-Linux -Pri-2 Pri-3
Summary: cloneNode(true) does not clone value of select (was: clonenode(deep) dont clone value of select)