domhandler
Advanced tools
Comparing version 2.0.2 to 2.0.3
38
index.js
@@ -95,11 +95,18 @@ var ElementType = require("domelementtype"); | ||
var lastTag; | ||
if(this._tagStack.length){ | ||
var lastTag; | ||
if( | ||
(lastTag = this._tagStack[this._tagStack.length - 1]) && | ||
(lastTag = lastTag.children[lastTag.children.length - 1]) && | ||
lastTag.type === ElementType.Text | ||
){ | ||
lastTag.data += data; | ||
return; | ||
if( | ||
(lastTag = this._tagStack[this._tagStack.length - 1]) && | ||
(lastTag = lastTag.children[lastTag.children.length - 1]) && | ||
lastTag.type === ElementType.Text | ||
){ | ||
lastTag.data += data; | ||
return; | ||
} | ||
} else { | ||
if(this.dom.length && this.dom[this.dom.length-1].type === ElementType.Text){ | ||
this.dom[this.dom.length-1].data += data; | ||
return; | ||
} | ||
} | ||
@@ -130,13 +137,8 @@ | ||
//TODO remove duplicated code | ||
DomHandler.prototype.oncdata = function(data){ | ||
var lastTag = this._tagStack[this._tagStack.length - 1]; | ||
if(lastTag && lastTag.type === ElementType.CDATA){ | ||
lastTag.data += data; | ||
return; | ||
} | ||
DomHandler.prototype.oncdatastart = function(){ | ||
var element = { | ||
data: data, | ||
children: [{ | ||
data: "", | ||
type: ElementType.Text | ||
}], | ||
type: ElementType.CDATA | ||
@@ -143,0 +145,0 @@ }; |
{ | ||
"name": "domhandler", | ||
"version": "2.0.2", | ||
"description": "htmlparser2's dom as a separate module", | ||
"version": "2.0.3", | ||
"description": "handler for htmlparser2 that turns pages into a dom", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "directories": { |
@@ -17,9 +17,4 @@ { | ||
"type": "text" | ||
}, | ||
{ | ||
"type": "tag", | ||
"name": "br", | ||
"attribs": {} | ||
} | ||
] | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
18617
28
0
0
701