问题描述
Mootools和ExtJ在同一页面上使用兼容性问题。 Mootools引发以下错误: 未捕获TypeError:对象#的属性'id'< HTMLDocument>不是一个函数
我们如何可以并用两个框架?有没有解决方法?
这看起来像一个 document.id('..')
引用问题,它被定义,但它不是mootools方法...
如果没有指向mootools方法,没有任何工作。
我会认为ExtJS或您的应用程序已将文件中添加了一个属性 id
,这不是一个函数很可能是一个字符串或另一个原语。
很确定ExtJS不会覆盖 document.id
,特别是考虑到(Sencha)使用MooTools核心团队dev @subtlegradient(thomas aylott)谁共同撰写了Slick选择器引擎,并帮助工程师在MooTools中从简单的$ 1.11
document.id转换
您可能无法通过引用将其还原,因此它已被覆盖。
只有在ExtJS加载和启动后才能尝试加载MooTools - 或加载MooTools,保存一个ref,如$ code> document。$ id = document。 id;
立即加载ExtJS,然后通过 document.id = document。$ id;删除文件$ id
- 仍然不能保证这将在正确的时间运行。您真的需要查看哪些修改您的文档
对象在Web检查器(您可以添加观察者) Mootools and ExtJs have a compatibility issue when used on the same page. Mootools throws the following error :
Uncaught TypeError: Property 'id' of object #<HTMLDocument> is not a function
How can we use both frameworks side by side ? Is there a workaround ?
This looks like a document.id('..')
reference issue, it is defined but it's not the mootools method...
Nothing will work if it's not pointed to the mootools method.
I would argue that ExtJS or your app has added a property id
to document, which is not a function as is likely a String or another primitive.
Pretty sure that ExtJS would not have been overwriting document.id
, especially given that they (Sencha) employed MooTools core team dev @subtlegradient (thomas aylott) who co-wrote the Slick selector engine and helped engineer the document.id
transition in MooTools from the simple $ in 1.11
You probably cannot do document.id = $
to restore it as it's by reference and it's been overwritten.
Only chance is to try loading MooTools after ExtJS is loaded and started - or load MooTools, save a ref like document.$id = document.id;
immediately after, load ExtJS and then restore it back when ready via document.id = document.$id; delete document.$id
- still no guarantees this will run at the right time. you really need to see what modifies your document
object in web inspector (you can add a watcher)
这篇关于Mootools和ExtJs 4.x似乎是不兼容的,如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!