未捕获的TypeError:无法在ko.cleanNode上读取未定义的属性"nodeType"

Tee*_*eej 4 knockout.js

  var ready;

  ready = function() {
    var imageChooser, productChooser;
    productChooser = function() {
      var self;
      self = this;
      self.quantityId = ko.observable(1);
      self.quantityText = ko.observable('QTY');
      self.genderId = ko.observable(1);
      self.sizeId = ko.observable(1);
      self.colorId = ko.observable(1);
      self.fullSize = ko.observable('SIZE');
      this.setGenderAndSize = function(stringtoparse, thestring) {
        var values;
        values = stringtoparse.split(":");
        self.fullSize("SIZE: " + thestring);
        self.genderId(values[0]);
        self.sizeId(values[1]);
      };
      this.setQuantity = function(quantity) {
        self.quantityId(quantity);
        self.quantityText("QTY: " + quantity);
      };
    };
    imageChooser = function() {
      this.clicked = ko.observable();
      this.setBigImage = (function(message) {
        alert(message);
      }).bind(this);
    };
    ko.applyBindings(new productChooser(), $("#genderAndSizeChooser")[0]);
    ko.cleanNode($('#genderAndSizeChooser')[0]);
    return ko.applyBindings(new imageChooser(), $('#imageChooser')[0]);
  };

  $(document).on('ready page:load', ready);
Run Code Online (Sandbox Code Playgroud)

我目前有这个代码.不知何故,ko.cleanNode代码:

ko.cleanNode($('#genderAndSizeChooser')[0]);
Run Code Online (Sandbox Code Playgroud)

生成错误:

Uncaught TypeError: Cannot read property 'nodeType' of undefined
Run Code Online (Sandbox Code Playgroud)

任何人都知道错误的原因?

RP *_*yer 5

看起来它实际上没有找到id为的元素genderAndSizeChooser.

ko.applyBindings通话将接受undefined并应用绑定到身体像正常的,这样,才不会出错,但调用ko.cleanNodeundefined会导致错误.