mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
Fixed case on mapping to $.toJSON
* Also made uses of JSON.stringify use ve.getHash Change-Id: I05dc0374e05b72c798ae0fd44239e5f8bb45ca52
This commit is contained in:
parent
272f502693
commit
c38a552442
|
@ -199,7 +199,7 @@ ve.dm.HTMLConverter.generateAnnotatedContent = function( content, annotations )
|
|||
if ( annotations[i].data !== undefined && Object.keys(annotations[i].data).length === 0 ) {
|
||||
delete annotations[i].data;
|
||||
}
|
||||
annoationMap[JSON.stringify( annotations[i] )] = annotations[i];
|
||||
annoationMap[ve.getHash( annotations[i] )] = annotations[i];
|
||||
}
|
||||
for ( i = 0; i < characters.length; i++ ) {
|
||||
characters[i] = [characters[i], annoationMap];
|
||||
|
|
|
@ -68,12 +68,16 @@ ve.inArray = $.inArray;
|
|||
*
|
||||
* This is actually an alias for jQuery.json, which falls back to window.JSON if present.
|
||||
*
|
||||
* WARNING: 2 objects can have the same contents but not the same hash if the properties were set
|
||||
* in a different order. Recursive sorting may nessecary prior to hashing, or a hashing algorithm
|
||||
* that produces order-safe reults may need to be used here instead.
|
||||
*
|
||||
* @static
|
||||
* @method
|
||||
* @param {Object} obj Object to generate hash for
|
||||
* @returns {String} Hash of object
|
||||
*/
|
||||
ve.getHash = $.toJson;
|
||||
ve.getHash = $.toJSON;
|
||||
|
||||
/**
|
||||
* Gets an array of all property names in an object.
|
||||
|
|
Loading…
Reference in a new issue