From 45711c581a46949addb38ecf7d78685e99ccc39e Mon Sep 17 00:00:00 2001 From: Andrew Boyd Date: Sat, 2 May 2020 09:34:15 -0400 Subject: [PATCH] reset hasGivenName check to more explicit string matching. --- src/libs/context.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libs/context.js b/src/libs/context.js index 5f5dc57..53dc32d 100644 --- a/src/libs/context.js +++ b/src/libs/context.js @@ -164,7 +164,17 @@ function nameOrFallback () { * determine if an input has a user-defined name */ function hasGivenName () { -return typeof this.name !== 'boolean' + if ( + this.name && + typeof this.name === 'string' && + this.name !== `${this.type}_${this.id}` && + this.name !== `${this.type}_${this.defaultId}` && + // radio and checkbox options have their value as part of their ID so we need to filter those out too + this.name !== `${this.type}_${(String(this.id).replace('_' + String(this.value), ''))}` + ) { + return true + } + return false } /**