Mootools and ExtJs 4.x seem to be incompatible, how to solve?

十年热恋 提交于 2019-12-10 16:42:56

问题


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 ?


回答1:


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)



来源:https://stackoverflow.com/questions/19226742/mootools-and-extjs-4-x-seem-to-be-incompatible-how-to-solve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!