Skip to content
Browse files

MDL-40470 JavaScript: Correct issue when checking select change in Fi…

…refox
  • Loading branch information...
1 parent 5c74090 commit 4b98297808a8228d129d58a999eba536ff92317a @andrewnicols andrewnicols committed Oct 15, 2013
View
4 lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js
@@ -74,8 +74,8 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
startindex = select.getData('startindex');
currentindex = select.get('selectedIndex');
- previousindex = select.getAttribute('data-previousindex');
- select.setAttribute('data-previousindex', currentindex);
+ previousindex = parseInt(select.getData('previousindex'), 10);
+ select.setData('previousindex', currentindex);
if (!previousindex) {
previousindex = startindex;
}
View
2 lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js
@@ -1 +1 @@
-YUI.add("moodle-core-formautosubmit",function(e,t){var n,r="core-formautosubmit",i,s=!1;n={AUTOSUBMIT:"autosubmit"},i=function(){i.superclass.constructor.apply(this,arguments)},e.extend(i,e.Base,{initializer:function(){var t,r;s||(s=!0,t=e.one("body"),t.delegate("key",this.process_changes,"press:13","select."+n.AUTOSUBMIT,this),t.delegate("click",this.process_changes,"select."+n.AUTOSUBMIT,this),e.UA.os==="macintosh"&&e.UA.webkit&&t.delegate("change",this.process_changes,"select."+n.AUTOSUBMIT,this),(e.UA.ios||e.UA.android)&&t.delegate("change",this.process_changes,"select."+n.AUTOSUBMIT,this)),this.get("selectid")&&(r=e.one("select#"+this.get("selectid")),r&&(this.get("nothing")&&r.setData("nothing",this.get("nothing")),r.setData("startindex",r.get("selectedIndex"))))},check_changed:function(e){var t,r,i,s,o;return t=e.target.ancestor("select."+n.AUTOSUBMIT,!0),t?(r=t.getData("nothing"),i=t.getData("startindex"),s=t.get("selectedIndex"),o=t.getAttribute("data-previousindex"),t.setAttribute("data-previousindex",s),o||(o=i),r!==!1&&t.get("value")===r||i===t.get("selectedIndex")||s===o?!1:t):!1},process_changes:function(e){var t=this.check_changed(e),n;t&&(n=t.ancestor("form",!0),n.submit())}},{NAME:r,ATTRS:{selectid:{value:""},nothing:{value:""},ignorechangeevent:{value:!1}}}),M.core=M.core||{},M.core.init_formautosubmit=M.core.init_formautosubmit||function(e){return new i(e)}},"@VERSION@",{requires:["base","event-key"]});
+YUI.add("moodle-core-formautosubmit",function(e,t){var n,r="core-formautosubmit",i,s=!1;n={AUTOSUBMIT:"autosubmit"},i=function(){i.superclass.constructor.apply(this,arguments)},e.extend(i,e.Base,{initializer:function(){var t,r;s||(s=!0,t=e.one("body"),t.delegate("key",this.process_changes,"press:13","select."+n.AUTOSUBMIT,this),t.delegate("click",this.process_changes,"select."+n.AUTOSUBMIT,this),e.UA.os==="macintosh"&&e.UA.webkit&&t.delegate("change",this.process_changes,"select."+n.AUTOSUBMIT,this),(e.UA.ios||e.UA.android)&&t.delegate("change",this.process_changes,"select."+n.AUTOSUBMIT,this)),this.get("selectid")&&(r=e.one("select#"+this.get("selectid")),r&&(this.get("nothing")&&r.setData("nothing",this.get("nothing")),r.setData("startindex",r.get("selectedIndex"))))},check_changed:function(e){var t,r,i,s,o;return t=e.target.ancestor("select."+n.AUTOSUBMIT,!0),t?(r=t.getData("nothing"),i=t.getData("startindex"),s=t.get("selectedIndex"),o=parseInt(t.getData("previousindex"),10),t.setData("previousindex",s),o||(o=i),r!==!1&&t.get("value")===r||i===t.get("selectedIndex")||s===o?!1:t):!1},process_changes:function(e){var t=this.check_changed(e),n;t&&(n=t.ancestor("form",!0),n.submit())}},{NAME:r,ATTRS:{selectid:{value:""},nothing:{value:""},ignorechangeevent:{value:!1}}}),M.core=M.core||{},M.core.init_formautosubmit=M.core.init_formautosubmit||function(e){return new i(e)}},"@VERSION@",{requires:["base","event-key"]});
View
4 lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js
@@ -73,8 +73,8 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
startindex = select.getData('startindex');
currentindex = select.get('selectedIndex');
- previousindex = select.getAttribute('data-previousindex');
- select.setAttribute('data-previousindex', currentindex);
+ previousindex = parseInt(select.getData('previousindex'), 10);
+ select.setData('previousindex', currentindex);
if (!previousindex) {
previousindex = startindex;
}
View
4 lib/yui/src/formautosubmit/js/formautosubmit.js
@@ -72,8 +72,8 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
startindex = select.getData('startindex');
currentindex = select.get('selectedIndex');
- previousindex = select.getAttribute('data-previousindex');
- select.setAttribute('data-previousindex', currentindex);
+ previousindex = parseInt(select.getData('previousindex'), 10);
+ select.setData('previousindex', currentindex);
if (!previousindex) {
previousindex = startindex;
}

0 comments on commit 4b98297

Please sign in to comment.
Something went wrong with that request. Please try again.