jQuery on IE8, error: Object doesn't support this property or method

后端 未结 2 1131
不思量自难忘°
不思量自难忘° 2021-01-19 19:31

I have jQuery for a WordPress theme I\'m building. I\'ve given up for now on testing IE6 and IE7 (layouting hell), and now I\'m testing it using IE8. Every time I click on a

2条回答
  •  无人及你
    2021-01-19 20:13

    The line in jQuery (minified version) that's causing the error is:

    somehwere in line 140: var C=Bb.exec(u)

    The solution is to change this line to:

    var C=Bb.exec(u.toString())

    @kirilloid is correct in that Regexp is throwing the error especially when the value being matched is numeric. e.g. animating css properties such as opacity, top, left, etc. Converting it to string fixes the problem. Now IE is not getting any more errors.

    I don't like this fix very much since I edited the jQuery library file, but I guess I'll have to make do with it. The change doesn't have to have any bad side effects to normal functionality.

提交回复
热议问题