javascript - Chrome 57+ 上的 RichFaces 应用程序出现 JS 错误 "Cannot read property ' switchToItem' 未定义”

标签 javascript java google-chrome jsp richfaces

我有一个带有选项卡的 jsp 页面。有时会出现错误(当我按下选项卡时)“无法读取未定义的属性‘switchToItem’” undefined error

Uncaught TypeError: Cannot read property 'switchToItem' of undefined 
at init.__onHeaderClick (packed.js:6102)
at HTMLTableCellElement.<anonymous> (packed.js:1333)
at HTMLTableCellElement.dispatch (jquery.js:846)
at HTMLTableCellElement.eventHandle (jquery.js:722)

据我了解,错误发生在packed.js中(这是由4.3.4版本的richfaces打包的js文件)。我查看了该文件,发现 RichFaces 尝试查找选项卡列表。这些选项卡位于属性“rf”( element[richfaces.RICH_CONTAINER] )中,但是当我按下选项卡时,没有属性。

此错误在 chrome v.57 中重现,在版本 56 中不会重现。 您能帮我提供一些建议吗?如何解决?

一些技术细节:

  • 我使用xmlns:rich="http://richfaces.org/rich" <rich:tabPanel>我的 jsp 页面中的标记
  • 在 pom.xml <richfaces.version>4.3.4.Final</richfaces.version>

最佳答案

James G,richfaces.js 中有一个错误

   richfaces.$$ = function(componentName, element) {
        while (element.parentNode) {
            var containerId = element.getAttribute(richfaces.RICH_CONTAINER);
            if (containerId && containerId !== "" && !!richfaces.COMPONENT_MAP[containerId] && richfaces.COMPONENT_MAP[containerId].component.name == componentName) {
                return e.component;
            }
            else {
                element = element.parentNode;
            }
        }
};

没有e。您需要将其更改为

...
return richfaces.COMPONENT_MAP[containerId].component;
...

关于javascript - Chrome 57+ 上的 RichFaces 应用程序出现 JS 错误 "Cannot read property ' switchToItem' 未定义”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43072230/

相关文章:

html - 尝试删除 Chrome 中 Paypal 输入周围的边框

c# - 如何使用 Selenium WebDriver 将缩放重置为 Chrome 上的默认值?

jquery .width() chrome 和 safari 问题

javascript - React 路由不工作 v4

javascript - 使用 gulp-babelignore 转译 Nodejs 应用程序不起作用

无缘无故发生Java错误 "This method must return a result of type string"

java - Android FTP 更改目录失败

java - 按下后退按钮时如何将布局设置为先前的布局?

javascript - Jquery-On点击改变循环

javascript - 显示和隐藏 div 用于缩短动态出现的文本