diff options
-rw-r--r-- | bundles/org.eclipse.orion.client.webtools/web/webtools/htmlAstManager.js | 13 |
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(); } }, |