博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
maximum call stack size exceeded error in chrome using jquery templates
阅读量:6124 次
发布时间:2019-06-21

本文共 1465 字,大约阅读时间需要 4 分钟。

hot3.png

I had the same issue. If you look to jquery.tmpl code you can find

function build( tmplItem, nested, content ) { ...

The problem is in

jQuery.map( content, function( item ) {

for each item in the 'content' array (and you have i guess more than 50000 elements here) should be called function. This is too much for Webkit browsers. This code was modified a little to solve my issue:

function build( tmplItem, nested, content ) {    // Convert hierarchical content into flat string array    // and finally return array of fragments ready for DOM insertion    var processMap = function(){        var result = [];        var items = [];        for(var i = 0; i
])(?![^>]*_tmplitem)([^>]*)/g, "$1 " + tmplItmAtt + "=\"" + tmplItem.key + "\" $2" ) : item) : // This is a child template item. Build nested template. build( item, tmplItem, item._ctnt ); }); result = result.concat(items); } return result; }; var frag, ret = content ? processMap(): // If content is not defined, insert tmplItem directly. Not a template item. May be a string, or a string array, e.g. from {
{html $item.html()}}. tmplItem; if ( nested ) { return ret; } ...

So jQuery.map function process each 10000 elements and doesn't allow 'Maximum call stack size exceeded'.

This is a crude solution but hope it helps you :)

转载于:https://my.oschina.net/yves175/blog/1301819

你可能感兴趣的文章
Response. AppendHeader使用大全及文件下载.net函数使用注意点(转载)
查看>>
Wait Functions
查看>>
代码描述10313 - Pay the Price
查看>>
jQuery最佳实践
查看>>
centos64i386下apache 403没有权限访问。
查看>>
vb sendmessage 详解1
查看>>
jquery用法大全
查看>>
Groonga 3.0.8 发布,全文搜索引擎
查看>>
PC-BSD 9.2 发布,基于 FreeBSD 9.2
查看>>
网卡驱动程序之框架(一)
查看>>
css斜线
查看>>
Windows phone 8 学习笔记(3) 通信
查看>>
重新想象 Windows 8 Store Apps (18) - 绘图: Shape, Path, Stroke, Brush
查看>>
Revit API找到风管穿过的墙(当前文档和链接文档)
查看>>
Scroll Depth – 衡量页面滚动的 Google 分析插件
查看>>
Windows 8.1 应用再出发 - 视图状态的更新
查看>>
自己制作交叉编译工具链
查看>>
Qt Style Sheet实践(四):行文本编辑框QLineEdit及自动补全
查看>>
[物理学与PDEs]第3章习题1 只有一个非零分量的磁场
查看>>
深入浅出NodeJS——数据通信,NET模块运行机制
查看>>