[333358] [formatting] formatting inserts Break in text node even if there is no sibling
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/format/HTMLFormatter.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/format/HTMLFormatter.java
index 99384cd..07fb206 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/format/HTMLFormatter.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/format/HTMLFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -774,7 +774,7 @@
}
else if (theNode.getNodeType() == Node.TEXT_NODE) {
Node next = theNode.getNextSibling();
- if (next != null && formattingUtil.isInline(next)) {
+ if (next != null && formattingUtil.isInline(next) || theParentElement.getChildNodes().getLength() <= 1) {
result = false;
}
}
@@ -800,6 +800,8 @@
* a child of a inline element or a next sibling to an inline element*/
} else if (allowNewlineBefore(theNode)) {
result = false;
+ } else if (theNode.getNodeType() == Node.TEXT_NODE && theParentElement.getChildNodes().getLength() <= 1) {
+ result = false;
}
return result;
}