2

IE7で「メソッドまたはプロパティアクセスへの予期しない呼び出し」が発生しましたが、スクリプトがIE8で機能せず、その理由を一生理解できません。

私はIE(woohooo!)で開発者ツールを使用していますが、あまり役に立ちません。私が得ているエラーはJqueryにあります:

SCRIPT65535:メソッドまたはプロパティアクセスへの予期しない呼び出し。jquery.js?ver = 1.7.1、3行目文字31871

IE9、Safari、FF、Chromeで問題なく動作します。

Htmlページで、次のリンクをクリックします。このリンクをクリックすると、data-tax属性の値がスクリプトに渡されます。おそらくそれはhtml5と何か関係があると思いますか?どんなポインタでも大歓迎です。

たとえば、Brad Pittをクリックすると、BradPittが出演している映画が表示されます。

<li class="ajaxFilterItem brad-pitt af-actor-6 filter-selected" data-tax="actor=6"><a href="#" class="ajax-filter-label"><span class="checkbox"></span>Brad Pitt</a> (1)</li>

次の値をに渡します

filterAjaxify("actor=6")

そして、これは問題のあるコードです:

(function($){
    var isRunning = false;
    // Return an array of selected navigation classes.
    function loopSelected(_node) {
        var _arr = [];
        _node.each(function(){
            var _class = $(this).attr('data-tax');
            _arr.push(_class);
        });
        return _arr;
    };

    // Animate the progress bar based on Ajax step completion.
    function increaseProgressBar(percent){
        $('div#progbar').animate({
            width: percent + '%'
        },30);
    };

    // Join the array with an & so we can break it later.
    function returnSelected(){
        var selected = loopSelected($('li.filter-selected'));
            return selected.join('&');
    };

    // When the navigation is clicked run the ajax function.
    $('a.ajax-filter-label, a.paginationNav, a.pagelink').live('click', function(e) {
        if(isRunning == false){
            isRunning = true;
            e.preventDefault();
            var relation = $(this).attr('rel');
            if($(this).parent('li').length > 0) {
                $(this).parent('li').toggleClass('filter-selected');
                thisPage = 1;
            }
            if(relation === 'next'){
                thisPage++;
            } else if(relation === 'prev') {
                thisPage--;
            } else if($(this).hasClass('pagelink')){
                thisPage = relation;
            }
            filterAjaxify(returnSelected());
        }
    });

    // Do all the ajax functions.
    function filterAjaxify(selected){
        $.ajax({
            url: ajaxurl,
            type: 'post',
            data: {
                "action":"affilterposts",
                "filters": selected,
                "posttypes": posttypes,
                "qo": qo,
                "paged": thisPage,
                "_ajax_nonce": nonce
            },
            beforeSend: function(){
                $('div#ajax-loader').fadeIn();
                $('section#ajax-filtered-section').fadeTo('slow',0.4);
                increaseProgressBar(33);
            },
            success: function(html){
                increaseProgressBar(80);
                $('section#ajax-filtered-section').html(html);
            },
            complete: function(){
                $('section#ajax-filtered-section').fadeTo('slow',1);
                increaseProgressBar(100);
                $('div#ajax-loader').fadeOut();
                isRunning = false;
            },
            error: function(){}
        });
    };
})(jQuery);
4

1 に答える 1

5

これ<section>はHTML5の新機能であり、古いIEはそれを消化する方法を知らず、そのような要素に何かを追加しようとするとDOMの問題が発生します。

例: http: //jsfiddle.net/EKU7R/

于 2012-06-16T10:09:10.340 に答える