Skip to content

Commit 5061afc

Browse files
authored
Merge pull request #25 from WebCoder49/sync-name
Sync name attribute
2 parents 17c9f16 + a010e3e commit 5061afc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

code-input.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
var codeInput = {
66
observedAttributes: [
77
"value",
8+
"name",
89
"placeholder",
910
"lang",
1011
"template",
@@ -156,7 +157,6 @@ var codeInput = {
156157

157158
if (this.getAttribute("name")) {
158159
textarea.setAttribute("name", this.getAttribute("name")); // for use in forms
159-
this.removeAttribute("name");
160160
}
161161

162162
textarea.setAttribute("oninput", "this.parentElement.update(this.value); this.parentElement.sync_scroll();");
@@ -208,7 +208,12 @@ var codeInput = {
208208

209209
case "value":
210210
this.update(newValue);
211-
211+
break;
212+
213+
case "name":
214+
if(this.querySelector("textarea") !== null) {
215+
this.querySelector("textarea").setAttribute("name", newValue); // for use in forms
216+
}
212217
break;
213218

214219
case "placeholder":

0 commit comments

Comments
 (0)