【发布时间】:2014-12-04 01:21:26
【问题描述】:
在使用 Stripe 处理信用卡时,我在浏览器上收到此错误。
Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('hidden') does not support selection.
Stripe.utils.r.serialize
Stripe.utils.r.serialize
Stripe.utils.r.serialize
Stripe.utils.r.serialize
Stripe.ajaxJSONP
e.request
t.create
n.createToken
Acpremium.Views.FyUpgradeCCCaptureView.FyUpgradeCCCaptureView.onPaymentSubmit
p.event.dispatch
g.handle.h
我的代码使用 Backbone 和 CoffeeScript 来调用 Stripe。在 2014 年 11 月 6 日之前,我的代码(如下所示)一直在运行和处理付款。从那时起,上述错误开始发生。
我的代码中的条带调用:
onPaymentSubmit: (event) =>
event.preventDefault()
$("*").addClass("busy")
paymentForm = @$('#payment-form')
paymentForm.find('button').prop('disabled', true)
Stripe.card.createToken paymentForm, @stripeResponseHandler
false
如果我更改代码
paymentForm = @$('#payment-form')
到
paymentForm = $('#payment-form')
处理完成。对此有什么解释吗?
一个较早的stackoverflow问题How to fit Stripe into Backbone View? 表示@$ 是正确的方法,直到最近@$ 也为我工作。
还有其他人在 Stripe 上遇到过这个问题吗?
【问题讨论】:
-
您的代码在 11 月 6 日前后发生了什么变化?
-
什么都没有。代码已经 4 个月了。这就是令我惊讶的地方。该错误是从 stripe.js 的深处抛出的。 Stripe 支持表示没有其他人报告过类似的问题。
-
表单的 HTML 是什么样的?错误消息表明
<input type="hidden">正在触发问题。是否有任何 Backbone、Underscore、jQuery 等升级? -
输入元素是 在我的支付表单中。这条线在过去的 4 个月里一直在那里。我没有对库进行版本更改。不确定 stripe.js 是否在内部依赖于任何 Backbone、Underscor 库并且存在版本不匹配。
标签: backbone.js coffeescript stripe-payments