Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DomHandler.prototype.onopentag = function(name, attribs){
var element = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: []
};
this._addDomElement(element);
this._tagStack.push(element);
};
DomHandler.prototype.onopentag = function(name, attribs){
var element = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: []
};
this._addDomElement(element);
this._tagStack.push(element);
};
DomHandler.prototype.onopentag = function(name, attribs){
var lastTag = this._tagStack[this._tagStack.length - 1];
var element = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: [],
prev: null,
next: null,
parent: lastTag || null
};
if(lastTag){
var idx = lastTag.children.length;
while(idx > 0){
if(ElementType.isTag(lastTag.children[--idx])){
element.prev = lastTag.children[idx];
lastTag.children[idx].next = element;
break;
}
DomHandler.prototype.onopentag = function(name, attribs){
var lastTag = this._tagStack[this._tagStack.length - 1];
var element = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: [],
prev: null,
next: null,
parent: lastTag || null
};
if(lastTag){
var idx = lastTag.children.length;
while(idx > 0){
if(ElementType.isTag(lastTag.children[--idx])){
element.prev = lastTag.children[idx];
lastTag.children[idx].next = element;
break;
}
DomHandler.prototype.onopentag = function(name, attribs){
var element = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: []
};
this._addDomElement(element);
this._tagStack.push(element);
};
DomHandler.prototype.onopentag = function(name, attribs){
var element = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: []
};
this._addDomElement(element);
this._tagStack.push(element);
};
DomHandler.prototype.onopentag = function(name, attribs){
var properties = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: []
};
var element = this._createDomElement(properties);
this._addDomElement(element);
this._tagStack.push(element);
};
DomHandler.prototype.onopentag = function(name, attribs){
var properties = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: []
};
var element = this._createDomElement(properties);
this._addDomElement(element);
this._tagStack.push(element);
};
DomHandler.prototype.onopentag = function(name, attribs){
var lastTag = this._tagStack[this._tagStack.length - 1];
var element = {
type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
name: name,
attribs: attribs,
children: [],
prev: null,
next: null,
parent: lastTag || null
};
if(lastTag){
var idx = lastTag.children.length;
while(idx > 0){
if(ElementType.isTag(lastTag.children[--idx])){
element.prev = lastTag.children[idx];
lastTag.children[idx].next = element;
break;
}
}, function(element) {
if(element.type === ElementType.Script) scripts.push(element);
if(element.type === ElementType.Style) stylesheets.push(element);
if(element.type === ElementType.Tag && element.name === 'link' && element.attribs.rel === 'stylesheet') stylesheets.push(element);
if(element.type === ElementType.Tag && element.name === 'img') images.push(element);
if(element.type === ElementType.Tag && element.name === 'a') anchors.push(element);
if(element.type === ElementType.Tag && element.name === 'title') title = element;
});