默认情况下禁用付款方式输入框 - 有趣的 Javascript 不兼容性
这段代码位于 Magento 的 onepagecheckout 的默认主题中 - 加载时它调用 payment.init() 这是一个对象文字函数:
init : function () {
var elements = Form.getElements(this.form);
var method = null;
for (var i=0; i<elements.length; i++) {
if (elements[i].name=='payment[method]') {
if (elements[i].checked) {
method = elements[i].value;
}
} else {
elements[i].disabled = true;
}
}
if (method) this.switchMethod(method);
},
出于某种原因,仅在 IE9 中,似乎输入框付款形式默认为“disabled=true”...有更好的方法来实现这一点吗? IE9 是唯一一个行为不端的浏览器...
更新:
我的临时修复是完全禁用此调用。我们不要求禁用隐藏字段。这是保持兼容性的要求吗?
This bit of code is in Magento's default theme for onepagecheckout - upon load it calls payment.init()
which is an object literal function:
init : function () {
var elements = Form.getElements(this.form);
var method = null;
for (var i=0; i<elements.length; i++) {
if (elements[i].name=='payment[method]') {
if (elements[i].checked) {
method = elements[i].value;
}
} else {
elements[i].disabled = true;
}
}
if (method) this.switchMethod(method);
},
For some reason, in IE9 only, it seems that the input boxes in the payment form default to "disabled=true"... is there a better way to accomplish this? IE9 is the only one that misbehaves here...
Update:
My temporary fix has been to disable this call altogether. We do not require hidden fields to be disabled. Is this a requirement to maintain compatibility?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能与 Magento 和 IE9 使用的旧 Prototype 库之间的不兼容有关。更多信息请访问:http://alanstorm.com/ie9_fix_for_magento
请注意,计划在下一版本中升级原型库。
This might be related to incompatibility between older Prototype library used by Magento and IE9. More information available here: http://alanstorm.com/ie9_fix_for_magento
Note that upgrade of Prototype library is planned for next releases.