• Learning jQuery, 4th Edition 勘误表


    来源于:http://book.learningjquery.com/3145/errata/

    Chapter 1

    page 14

    The CSS snippet is correct, but it differs from the CSS in the sample download at packtpub.com. Visit book.learningjquery.com for the complete updated code download.

    Chapter 2

    page 29

    The first paragraph reads:

    Notice that the first <ul> has an ID of selecting plays

    It should read:

    Notice that the first <ul> has an ID of selected plays

    Listing 2.2

    Line 3 of Listing 2.2 reads:

      $('#selected-plays li:not(.horizontal)').addClass('sub-
    level');li:not(.horizontal)').addClass('sub-level');
    

    It should read:

      $('#selected-plays li:not(.horizontal)').addClass('sub-level');
    

    Listing 2.5

    Lines 5–7 of Listing 2.5 read:

          .addClass('henrylink');
      });
    });
    

    Line 6 should be omitted, so the lines will just read:

          .addClass('henrylink');
    });
    

    page 46

    The two code blocks incorrectely omit a space for the variable declaration. They begin:

    varmyTag
    

    They should begin:

    var myTag
    

    Chapter 3

    no errata yet

    Chapter 4

    no errata yet

    Chapter 5

    no errata yet

    Chapter 6

    no errata yet

    Chapter 7

    no errata yet

    Chapter 8

    no errata yet

    Chapter 9

    Listing 9.8

    The jQuery interface to the Sizzle selector engine changed in the late stages of the writing of this book, and the pseudo-selectors no longer receive the index of an element as one of their arguments. Instead, 0 is always passed as the variable, which causes our custom selector to break:

    
    (function($) {
      $.extend($.expr[':'], {
        group: function(element, index, matches, set) {
          var num = parseInt(matches[3], 10);
          if (isNaN(num)) {
            return false;
          }
          return index % (num * 2) < num;
        }
      });
    })(jQuery);
    

    A replacement function can be written that uses Sizzle’s setFilters capability:

    
    (function($) {
      $.expr.setFilters.group = function(elements, argument, not) {
        var resultElements = [];
        for (var i = 0; i < elements.length; i++) {
          var test = i % (argument * 2) < argument;
          if ((!not && test) || (not && !test)) {
            resultElements.push(elements[i]);
          }
        }
        return resultElements;
      };
    })(jQuery);
    
    More information on setFilters can be found here: https://github.com/jquery/sizzle/wiki/Sizzle-Documentation#wiki-sizzleselectorssetfilterslowercase_name--function-elements-argument-not--

    Chapter 10

    no errata yet

    Chapter 11

    no errata yet

  • 相关阅读:
    解决IE6浏览器下position:fixed固定定位问题
    CSS中overflow:hidden在ie6、ie7无效不能隐藏解决办法
    liunx 中删除export设置的环境变量
    文件操作
    集合操作
    三级菜单
    字典操作
    字符串操作
    购物车程序
    列表操作
  • 原文地址:https://www.cnblogs.com/ys-wuhan/p/6150281.html
Copyright © 2020-2023  润新知