From abe81d42d74800759b262a93ee01922489f39f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Inez=20Korczyn=CC=81ski?= Date: Wed, 15 May 2013 10:00:10 -0700 Subject: [PATCH] Added method getDataFromDomRecursionClean to ve.dm.Converter - used by nodes that handle their own children. Change-Id: I604cf201515152824ec159b8c86f2010afcd3369 --- modules/ve/dm/ve.dm.Converter.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/ve/dm/ve.dm.Converter.js b/modules/ve/dm/ve.dm.Converter.js index 05425e8c72..fbfdbb262c 100644 --- a/modules/ve/dm/ve.dm.Converter.js +++ b/modules/ve/dm/ve.dm.Converter.js @@ -353,6 +353,26 @@ ve.dm.Converter.prototype.getDataFromDom = function ( doc, store, internalList ) return linearData; }; +/** + * Wrapper for getDataFromDomRecursion which resets contextStack before the call + * and then set it back after the call. + * + * TODO: This is kind of a hack, better implementation would be more appropriate in near future. + * + * @method + * @param {HTMLElement} domElement HTML element to convert + * @param {Object} [wrapperElement] Data element to wrap the returned data in + * @param {ve.dm.AnnotationSet} [annotationSet] Override the set of annotations to use + * @returns {Array} Linear model data + */ +ve.dm.Converter.prototype.getDataFromDomRecursionClean = function ( domElement, wrapperElement, annotationSet ) { + var result, contextStack = this.contextStack; + this.contextStack = []; + result = this.getDataFromDomRecursion( domElement, wrapperElement, annotationSet ); + this.contextStack = contextStack; + return result; +}; + /** * Recursive implementation of getDataFromDom(). For internal use, and for use in * ve.dm.Model.static.toDataElement() implementations.