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

html-select

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-select - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

11

lib/parse_tag.js

@@ -32,11 +32,12 @@ module.exports = function (buf) {

var kv = parts[j].split('=');
key = kv[0].toLowerCase();
key = kv[0].toLowerCase().trim();
if (kv.length > 1) {
value = kv.slice(1).join('=');
if (/^"/.test(value)) {
value = value.replace(/^"/, '').replace(/"$/, '');
if (/^\s*"/.test(value)) {
value = value.replace(/^\s*"/, '').replace(/"\s*$/, '');
}
else if (/^'/.test(value)) {
value = value.replace(/^'/, '').replace(/'$/, '');
else if (/^\s*'/.test(value)) {
value = value.replace(/^\s*'/, '').replace(/'\s*$/, '');
}
else value = value.trim();
}

@@ -43,0 +44,0 @@ else value = true;

{
"name": "html-select",
"version": "1.1.3",
"version": "1.1.4",
"description": "match a tokenized html stream with css selectors",

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

@@ -63,1 +63,46 @@ var select = require('../');

});
test('trailing whitespace attribute', function (t) {
t.plan(2);
var s = select('input[TypE=text]', function (e) {
t.equal(e.name, 'input');
t.deepEqual(e.attributes, { type: 'text', value: 'xyz' });
});
s.write([ 'open', '<html>' ]);
s.write([ 'open', '<body>' ]);
s.write([ 'open', '<input type="submit">' ]);
s.write([ 'open', '<input type="text" value ="xyz">' ]);
s.write([ 'close', '</body>' ]);
s.write([ 'close', '</html>' ]);
s.end();
});
test('attribute extra whitespace', function (t) {
t.plan(2);
var s = select('input[TypE=text]', function (e) {
t.equal(e.name, 'input');
t.deepEqual(e.attributes, { type: 'text', value: 'xyz' });
});
s.write([ 'open', '<html>' ]);
s.write([ 'open', '<body>' ]);
s.write([ 'open', '<input type="submit">' ]);
s.write([ 'open', '<input type="text" value = xyz >' ]);
s.write([ 'close', '</body>' ]);
s.write([ 'close', '</html>' ]);
s.end();
});
test('attribute whitespace around quotes', function (t) {
t.plan(2);
var s = select('input[TypE=text]', function (e) {
t.equal(e.name, 'input');
t.deepEqual(e.attributes, { type: 'text', value: 'xyz' });
});
s.write([ 'open', '<html>' ]);
s.write([ 'open', '<body>' ]);
s.write([ 'open', '<input type="submit">' ]);
s.write([ 'open', '<input type="text" value = "xyz" >' ]);
s.write([ 'close', '</body>' ]);
s.write([ 'close', '</html>' ]);
s.end();
});
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