当前位置: 动力学知识库 > 问答 > 编程问答 >

django - jstools build - JavaScript causes problems after compilation [SOLVED]

问题描述:

I am using Django framework along with Dojo. I have created a page and tested it and it works fine. Then, after compiling JS files using:

python manage.py jstools build

I start seeing many problems. For example:

Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '.dijitInputInner[data-timespan-visibility]='monthly'' is not a valid selector.

I've read that Dojo Query uses different selectors, for example CSS2, CSS3 and Lite. Can anyone provide info on this and help me compile JS files and make this work? Looks like I have to tell the compiler to use correct version of CSS selector.

UPDATE: Looks like the problem is with /static/js/profile.js There is an attriibute called selectorEngine which could be lite or acme. I need to find the way to use css3 selector. Looking for solution now.

网友答案:

It seems like you have syntax errors

Since you are using single quotes in your selector you need to wrap it with double quotes or escape your single quotes using \

'.dijitInputInner[data-timespan-visibility]='monthly''

change it to this

".dijitInputInner[data-timespan-visibility]='monthly'"
网友答案:

To solve this I had to go to /static/js/profile.js and change the value of selectorEngine to 'acme'. After doing this python manage.py jstools build went fine and the page was working. It looks like Dojo has removed default support for acme and set default query to lite.

分享给朋友:
您可能感兴趣的文章:
随机阅读: