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

trumpet

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trumpet - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

test/script_src.html

27

index.js

@@ -27,19 +27,36 @@ var sax = require('sax');

var pos = 0;
var inScript = false;
var scriptLen = 0;
var scriptStart = 0;
var update = function (type, tag) {
var len, src;
if (type === 'script') {
var len = tag.length;
src = tag;
len = tag.length;
scriptLen += len;
inScript = true;
}
else if (type === 'text') {
var len = parser.startTagPosition - pos - 1;
len = parser.startTagPosition - pos - 1;
}
else if (type === 'open' && tag && tag.name === 'SCRIPT'
&& tag.attributes.src) {
var len = 0;
len = 0;
}
else if (inScript) {
len = parser.position - scriptLen - parser.startTagPosition + 1;
scriptLen = 0;
inScript = false;
}
else {
var len = parser.position - parser.startTagPosition + 1;
len = parser.position - parser.startTagPosition + 1;
}
if (type === 'open' && tag && tag.name === 'SCRIPT') {
scriptLen = len;
}
pos = parser.position;
var src = buffered.slice(0, len);
src = src || buffered.slice(0, len);
buffered = buffered.slice(len);

@@ -46,0 +63,0 @@

2

package.json
{
"name" : "trumpet",
"version" : "0.3.2",
"version" : "0.3.3",
"description" : "parse and transform streaming html using css selectors",

@@ -5,0 +5,0 @@ "main" : "index.js",

@@ -6,3 +6,3 @@ var test = require('tap').test;

test('script', function (t) {
t.plan(2);
t.plan(6);

@@ -16,5 +16,18 @@ var tr = trumpet();

t.equal(src, 'console.log(i<j)');
t.end();
});
});
tr.select('title', function (node) {
t.equal(node.name, 'title');
node.html(function (html) {
t.equal(html, 'beep');
});
});
tr.select('.c', function (node) {
t.equal(node.name, 'div');
node.html(function (html) {
t.equal(html, 'boop');
});
});
});

Sorry, the diff of this file is not supported yet

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