Index: trunk/parsers/wikidom/lib/es/es.Transaction.js |
— | — | @@ -82,11 +82,20 @@ |
83 | 83 | } |
84 | 84 | var index; |
85 | 85 | for ( var i = 0; i < stack.length; i++ ) { |
86 | | - // TODO: Compare data too: es.Content.compareObjects( stack[i], val.annotation ) |
87 | | - if ( stack[i].type === val.annotation.type ) { |
88 | | - index = i; |
89 | | - break; |
| 86 | + // Type check |
| 87 | + if ( stack[i].type !== val.annotation.type ) { |
| 88 | + // Nope |
| 89 | + continue; |
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; |
91 | 100 | } |
92 | 101 | if ( index === undefined ) { |
93 | 102 | throw 'Annotation stack error. Annotation is missing.'; |