浏览代码

make the option element available to the matcher function when attached to select. can be used to match on option attributes as well as option text. fixes #227

Igor Vaynberg 13 年之前
父节点
当前提交
3a830a2b81
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      select2.js

+ 1 - 1
select2.js

@@ -622,7 +622,7 @@
                     process=function(element, collection) {
                     process=function(element, collection) {
                         var group;
                         var group;
                         if (element.is("option")) {
                         if (element.is("option")) {
-                            if (query.matcher(term, element.text())) {
+                            if (query.matcher(term, element.text(), element)) {
                                 collection.push({id:element.attr("value"), text:element.text(), element: element.get()});
                                 collection.push({id:element.attr("value"), text:element.text(), element: element.get()});
                             }
                             }
                         } else if (element.is("optgroup")) {
                         } else if (element.is("optgroup")) {