Sync #319 with trunk (#48348)

* Use DOM API to create Order Attribution inputs

* Add changelog entry

* Delete unnecessary changelog

---------

Co-authored-by: Tomek Wytrębowicz <tomalecpub@gmail.com>
This commit is contained in:
rodelgc 2024-06-11 16:40:35 +08:00 committed by GitHub
parent f1badbfb4b
commit deb15d201e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -166,12 +166,16 @@
* but it's not yet supported in Safari.
*/
connectedCallback() {
let inputs = '';
this.innerHTML = '';
const inputs = new DocumentFragment();
for( const fieldName of this._fieldNames ) {
const value = stringifyFalsyInputValue( ( this.values && this.values[ fieldName ] ) || '' );
inputs += `<input type="hidden" name="${params.prefix}${fieldName}" value="${value}"/>`;
const input = document.createElement( 'input' );
input.type = 'hidden';
input.name = `${params.prefix}${fieldName}`;
input.value = stringifyFalsyInputValue( ( this.values && this.values[ fieldName ] ) || '' );
inputs.appendChild( input );
}
this.innerHTML = inputs;
this.appendChild( inputs );
}
/**