undefined_methodError on less css code in phonegap application running on 2.2 android

被刻印的时光 ゝ 提交于 2019-12-25 02:23:02

问题


I spend quite some time everyday on stackoverflow. This place is really great!

But this is my very first question, so every advice about it is very welcome :)

I'm working on a mobile app using phonegap. I use less css and it works fine on my nexus 5, but I have an error related to less on my old htc desire under android 2.2 :

undefined_methodError: Object function(a,b){return b instanceof Array?a=this.flatten(b,a):a.push(b),a} has no method 'bind'

in index.less on line null, column 0:

1 // Constants

The last line is the first line in my index.css file.

I've been looking on google and here for two days and I don't find anything.

Here is my index.html code:

<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet/less" type="text/css" href="app/index.less" />
        <script type="text/javascript" src="phonegap.js"></script>
        <script type="text/javascript" src="lib/async.js"></script>
        <script type="text/javascript" src="lib/jquery-1.8.2.min.js"></script>
        <script type="text/javascript" src="lib/handlebars.js"></script>
        <script>
            less = {
                log_level: 1
            }
        </script>
        <script type="text/javascript" src="lib/less-1.5.0.min.js"></script>
        <title>Kwali.to</title>
    </head>
    <body>

        <script type="text/javascript" src="app/index.js"></script>
    </body>
</html>

I need to "compile" the less code on the client because I have many sizes that are dependent to the screen resolution.

I really have no idea how to solve this and I hope it's not just a matter of incompatibility with my too old android...

How to solve this? What can I do to make my code work? Any help will be appreciated :)

Thank you guys!


回答1:


See "Less Browser Support". I.e. Less requires an ES-5 compatible JavaScript environment to run in. You can use es5-shim polyfill which will add the JavaScript features that Less requires.



来源:https://stackoverflow.com/questions/21069543/undefined-methoderror-on-less-css-code-in-phonegap-application-running-on-2-2-an

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