[open-ils-commits] r17487 - branches/rel_2_0/Open-ILS/web/js/dojo/MARC (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Sep 3 15:58:07 EDT 2010
Author: miker
Date: 2010-09-03 15:58:01 -0400 (Fri, 03 Sep 2010)
New Revision: 17487
Modified:
branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Field.js
branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Record.js
Log:
backporting r17476, r17477 and r17486 from trunk -- MARC Dojo module improvements
Modified: branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Field.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Field.js 2010-09-03 19:55:06 UTC (rev 17486)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Field.js 2010-09-03 19:58:01 UTC (rev 17487)
@@ -47,7 +47,7 @@
},
addSubfields : function () {
- for (var i in arguments) {
+ for (var i = 0; i < arguments.length; i++) {
var code = arguments[i];
var value = arguments[++i];
this.subfields.push( [ code, value ] );
Modified: branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Record.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Record.js 2010-09-03 19:55:06 UTC (rev 17486)
+++ branches/rel_2_0/Open-ILS/web/js/dojo/MARC/Record.js 2010-09-03 19:58:01 UTC (rev 17487)
@@ -68,11 +68,11 @@
insertOrderedFields : function () {
var me = this;
- for ( var i in arguments ) { // arguments is special, and for..in is correct
+ for (var i = 0; i < arguments.length; i++) {
var f = arguments[i];
var done = false;
for (var j = 0; j < this.fields.length; j++) {
- if (f.tag > this.fields[j].tag) {
+ if (f.tag < this.fields[j].tag) {
this.insertFieldsBefore(this.fields[j], f);
done = true;
break;
@@ -83,12 +83,13 @@
},
insertFieldsBefore : function (target) {
- arguments.splice(0,1);
+ var args = Array.prototype.slice.call(arguments);
+ args.splice(0,1);
var me = this;
for (var j = 0; j < this.fields.length; j++) {
if (target === this.fields[j]) {
j--;
- dojo.forEach( arguments, function (f) {
+ dojo.forEach( args, function (f) {
me.fields.splice(j++,0,f);
});
break;
@@ -97,11 +98,12 @@
},
insertFieldsAfter : function (target) {
- arguments.splice(0,1);
+ var args = Array.prototype.slice.call(arguments);
+ args.splice(0,1);
var me = this;
for (var j = 0; j < this.fields.length; j++) {
if (target === this.fields[j]) {
- dojo.forEach( arguments, function (f) {
+ dojo.forEach( args, function (f) {
me.fields.splice(j++,0,f);
});
break;
More information about the open-ils-commits
mailing list