From 2d7d4866bc49095a5bd1ee08f7206ab087c42d16 Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Mon, 5 Dec 2011 20:08:49 +0000 Subject: [PATCH] Fixed misnamed method, and off by one issue when getting content data from a document --- modules/es/models/es.DocumentModel.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/es/models/es.DocumentModel.js b/modules/es/models/es.DocumentModel.js index 0325c8b42a..52ab93a9f6 100644 --- a/modules/es/models/es.DocumentModel.js +++ b/modules/es/models/es.DocumentModel.js @@ -618,7 +618,7 @@ es.DocumentModel.prototype.getElementFromNode = function( node ) { * @method * @param {es.DocumentModelNode} node Node to get element data for */ -es.DocumentModel.prototype.getContentDataFromNode = function( node ) { +es.DocumentModel.prototype.getElementDataFromNode = function( node ) { var length = node.getElementLength(); var offset = this.getOffsetFromNode( node ); if ( offset !== -1 ) { @@ -652,7 +652,9 @@ es.DocumentModel.prototype.getContentDataFromNode = function( node, range ) { } var offset = this.getOffsetFromNode( node ); if ( offset !== -1 ) { - offset++; + if ( node.type !== 'document' ) { + offset++; + } return this.data.slice( offset + range.start, offset + range.end ); } return null;