summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurtis Windatt <cwindatt@ca.ibm.com>2015-07-16 12:58:40 -0400
committerCurtis Windatt <cwindatt@ca.ibm.com>2015-07-16 13:00:04 -0400
commiteb051987351d15fe2bccd151bf2acb4d2c8ff065 (patch)
treedb306aa146ca40a1425b93cea01276d80656d4d4
parent39c798704d9426174b95b0b1bbeea2b6226714ff (diff)
downloadorg.eclipse.orion.client-origin/htmlparser2.zip
org.eclipse.orion.client-origin/htmlparser2.tar.gz
org.eclipse.orion.client-origin/htmlparser2.tar.bz2
Bug 472412 - htmlparser2... prevent errors with bad rangesorigin/htmlparser2
-rw-r--r--bundles/org.eclipse.orion.client.webtools/web/webtools/htmlAstManager.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlAstManager.js b/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlAstManager.js
index 0794481..021bdeb 100644
--- a/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlAstManager.js
+++ b/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlAstManager.js
@@ -54,8 +54,17 @@ define([
onclosetag: function(tagname, range){
var tag = this._getLastTag();
if(tag && tag.name === tagname) {
- tag.range[1] = range[1];
- tag.endrange = range;
+ if (range){
+ tag.range[1] = range[1];
+ tag.endrange = range;
+ } else {
+ // No matching closing tag
+ // TODO Need to add tests for this, can it have children as well as text?
+ if (tag.openrange && tag.text){
+ tag.range[1] = tag.openrange[1] + tag.text.value.length;
+ tag.endrange = [tag.range[1], tag.range[1]];
+ }
+ }
this.tagstack.pop();
}
},