Index: trunk/parsers/wikidom/lib/es/es.Transaction.js |
— | — | @@ -80,22 +80,13 @@ |
81 | 81 | } else { |
82 | 82 | throw 'Annotation method error. Unsupported annotation method: ' + val.method; |
83 | 83 | } |
| 84 | + // Find the index of a comparable annotation (checking for same value, not reference) |
84 | 85 | var index; |
85 | 86 | for ( var i = 0; i < stack.length; i++ ) { |
86 | | - // Type check |
87 | | - if ( stack[i].type !== val.annotation.type ) { |
88 | | - // Nope |
89 | | - continue; |
| 87 | + if ( es.Content.compareObjects( stack[i], val.annotation ) ) { |
| 88 | + index = i; |
| 89 | + break; |
90 | 90 | } |
91 | | - // Data check |
92 | | - if ( ( stack[i].data || stack[i].data ) |
93 | | - && !es.Content.compareObjects( stack[i], val.annotation ) ) { |
94 | | - // Nope |
95 | | - continue; |
96 | | - } |
97 | | - // Found it! |
98 | | - index = i; |
99 | | - break; |
100 | 91 | } |
101 | 92 | if ( index === undefined ) { |
102 | 93 | throw 'Annotation stack error. Annotation is missing.'; |