Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

context-parser

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

context-parser - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

2

bower.json
{
"name": "context-parser",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/yahoo/context-parser",

@@ -5,0 +5,0 @@ "description": "HTML5 Context Parser",

{
"name": "context-parser",
"version": "1.1.1",
"version": "1.1.2",
"licenses": [

@@ -5,0 +5,0 @@ {

@@ -335,2 +335,3 @@ /*

* @function FastParser#getStartTagName
* @depreciated Replace it by getCurrentTagIndex and getCurrentTag
*

@@ -341,6 +342,28 @@ * @returns {string} The current handling start tag name

FastParser.prototype.getStartTagName = function() {
return this.tags[0].toLowerCase();
return this.tags[0] !== undefined? this.tags[0].toLowerCase() : undefined;
};
/**
* @function FastParser#getCurrentTagIndex
*
* @returns {integer} The current handling tag Idx
*
*/
FastParser.prototype.getCurrentTagIndex = function() {
return this.tagIdx;
};
/**
* @function FastParser#getCurrentTag
*
* @params {integer} The tag Idx
*
* @returns {string} The current tag name indexed by tag Idx
*
*/
FastParser.prototype.getCurrentTag = function(tagIdx) {
return tagIdx === 0 || tagIdx === 1? (this.tags[tagIdx] !== undefined? this.tags[tagIdx].toLowerCase():undefined) : undefined;
};
/**
* @function FastParser#getAttributeName

@@ -347,0 +370,0 @@ *

@@ -219,2 +219,22 @@ /*

describe('#getCurrentTagIndex and #getCurrentTag', function(){
it('should return correct tag name/index', function(){
[ { html: "<div class='classname' style='color:red'></div>", tag0: 'div', tag1: 'div', index: 1},
{ html: "<div class='classname' style='color:red'></div> ", tag0: 'div', tag1: 'div', index: 1},
{ html: "<div class='classname' style='color:red'></div><img>", tag0: 'img', tag1: 'div', index: 0},
{ html: "<div class='classname' style='color:red'></div><img ", tag0: 'img', tag1: 'div', index: 0},
{ html: "<div class='classname' style='color:red'></div><img></im", tag0: 'img', tag1: 'im', index: 1},
{ html: "<div class='classname' style='color:red'></div><img></img ",tag0: 'img', tag1: 'img', index: 1},
].forEach(function(testObj) {
var p1 = new Parser(config);
p1.contextualize(testObj.html);
assert.equal(p1.getCurrentTag(0), testObj.tag0);
assert.equal(p1.getCurrentTag(1), testObj.tag1);
assert.equal(p1.getCurrentTagIndex(), testObj.index);
});
});
});
describe('#Constructor', function(){

@@ -221,0 +241,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc