奇怪的浏览器/ajax错误:firefox中的javascript文件末尾出现多余的垃圾 [英] Weird browser / ajax error : Extra junk appears at the end of javascript files in firefox

查看:135
本文介绍了奇怪的浏览器/ajax错误:firefox中的javascript文件末尾出现多余的垃圾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很奇怪.

我们正在使用Yahoo YUI和jQuery编写具有一些丰富的JavaScript UI的Django应用程序.

We're writing a Django application with some rich javascript UI, using both Yahoo YUI and jQuery.

我们的主页模板现在包括相当数量的js文件.我们开始在Firefox(3和3.5)中看到一个奇怪的错误.有时javascript崩溃.在Firebug中进行检查时,我们发现在一个YUI .js文件中发生了语法错误.当我们查看Firebug中的行时,我们发现它实际上是原始文件中不存在的行,但似乎是附加了一些垃圾JavaScript.

Our main page template now includes a fair number of js files. And we're starting to see a strange error in Firefox (3 and 3.5) . Sometimes the javascript crashes. And inspecting in Firebug we see that a syntax error occurred in one of the YUI .js files. When we look at the line in Firebug, we see that it's actually a line that doesn't exist in the original file, but seems to be some junk javascript that's got appended.

例如,分隔的yahoo-dom-event.js的最后一部分是

For example, the last part of a despaceed yahoo-dom-event.js is

YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.7.0", build: "1799"});

根据Firebug,现在看来该文件的末尾副本已添加到末尾,以

According to Firebug, this now seems to have a near copy of this file appended on the end, starting with

return M;},_getCacheIndex:function(Q,R,P){for(var O=0,N=I.length;O<N;O=O+1){var M=I[O]...

也许这是一些较早的代码,该代码在某个地方的缓冲区溢出了.

Perhaps this is some of the earlier code that's overflowed a buffer somewhere.

那么,其他人有没有经历过这样的事情?或知道这是我们堆栈之一的错误:

So, has anyone else experienced anything like this? Or knows this as a bug in one of the components of our stack :

  • Django
  • lighttpd
  • Firefox
  • 萤火虫
  • YUI
  • jQuery(也在页面上)

推荐答案

您应该阅读有关YUI如何处理其库导入的信息.可以将其配置为动态导入库,在这种情况下,它将压缩后导入它们(就像您在结尾处看到的代码一样.)在任何情况下,它都不是在某个地方的缓冲区溢出"的代码.

You should read up on how YUI handles importing of its libraries. It may be configured to import libraries dynamically, in which case it imports them compressed (like the code you're seeing at the end is.) In any case, it isn't code "that's overflowed a buffer somewhere."

该错误很可能不是在YUI或任何其他框架中出现的;错误在于您如何使用它.由于您没有提供任何相关信息,只有您提供帮助,我才能为您提供帮助.

Most likely the error isn't in YUI or any of the other frameworks; the error lies in how you use it. Since you have provided no information about that I can't help you until you do.

无论如何,请查看 YUI文档.

这篇关于奇怪的浏览器/ajax错误:firefox中的javascript文件末尾出现多余的垃圾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆