From 9d921744c33f894f83905cf5b4fd38d170bdc392 Mon Sep 17 00:00:00 2001 From: mytharcher Date: Fri, 20 Jul 2012 23:12:16 +0800 Subject: [PATCH] Fix #13: click current option item should not fire onchange event. --- src/esui/Select.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/esui/Select.js b/src/esui/Select.js index 767eadf..873b5ac 100644 --- a/src/esui/Select.js +++ b/src/esui/Select.js @@ -488,7 +488,7 @@ esui.Select.prototype = { * @param {HTMLElement} item 选项 */ _itemClickHandler: function ( item ) { - var index = item.getAttribute( 'index' ); + var index = parseInt( item.getAttribute( 'index' ), 10 ); var disabled = item.getAttribute( 'dis' ); if ( disabled == 1 ) { @@ -496,7 +496,7 @@ esui.Select.prototype = { } this.hideLayer(); - this.setSelectedIndex( parseInt( index, 10 ), true ); + this.setSelectedIndex( index, index != this.selectedIndex ); }, /**