r94920 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94919‎ | r94920 | r94921 >
Date:18:55, 18 August 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Simplified annotation comparison
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.Transaction.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Transaction.js
@@ -80,22 +80,13 @@
8181 } else {
8282 throw 'Annotation method error. Unsupported annotation method: ' + val.method;
8383 }
 84+ // Find the index of a comparable annotation (checking for same value, not reference)
8485 var index;
8586 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;
9090 }
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;
10091 }
10192 if ( index === undefined ) {
10293 throw 'Annotation stack error. Annotation is missing.';

Status & tagging log