Skip to content

Commit

Permalink
Fixed 'prevElement' error pointed out by Swizec
Browse files Browse the repository at this point in the history
  • Loading branch information
tautologistics committed Nov 10, 2010
1 parent 00fbea9 commit 83722ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions lib/node-htmlparser.js
Expand Up @@ -18,7 +18,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
***********************************************/
/* v1.6.3 */
/* v1.6.4 */

(function () {

Expand Down Expand Up @@ -244,17 +244,18 @@ function Parser (handler) {
element.type = ElementType.Text;
//If the previous element is text, append the current text to it
if (this._elements.length && this._elements[this._elements.length - 1].type == ElementType.Text) {
var prevElement = this._elements[this._elements.length - 1];
if (element.raw != "") {
var prevElement = this._elements[this._elements.length - 1];
prevElement.raw = prevElement.data = prevElement.raw + this._prevTagSep + element.raw;
element.raw = element.data = ""; //This causes the current element to not be added to the element list
}
else //Element is empty, so just append the last tag marker found
} else { //Element is empty, so just append the last tag marker found
prevElement.raw = prevElement.data = prevElement.raw + this._prevTagSep;
}
else //The previous element was not text
if (element.raw != "")
}
} else { //The previous element was not text
if (element.raw != "") {
element.raw = element.data = element.raw;
}
}
}
}
}
Expand Down

0 comments on commit 83722ba

Please sign in to comment.