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

xpath

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xpath - npm Package Compare versions

Comparing version 0.0.29 to 0.0.30

2

package.json
{
"name": "xpath",
"version": "0.0.29",
"version": "0.0.30",
"description": "DOM 3 XPath implemention and helper for node.js.",

@@ -5,0 +5,0 @@ "engines": {

@@ -20,5 +20,5 @@ const xpath = require('./xpath.js');

assert.equal('title', nodes[0].localName);
assert.equal('Harry Potter', nodes[0].firstChild.data);
assert.equal('<title>Harry Potter</title>', nodes[0].toString());
assert.strictEqual('title', nodes[0].localName);
assert.strictEqual('Harry Potter', nodes[0].firstChild.data);
assert.strictEqual('<title>Harry Potter</title>', nodes[0].toString());
});

@@ -30,12 +30,12 @@

var nodes = xpath.select('//title', doc);
assert.equal('title', nodes[0].localName);
assert.equal('Harry Potter', nodes[0].firstChild.data);
assert.equal('<title>Harry Potter</title>', nodes[0].toString());
assert.strictEqual('title', nodes[0].localName);
assert.strictEqual('Harry Potter', nodes[0].firstChild.data);
assert.strictEqual('<title>Harry Potter</title>', nodes[0].toString());
var nodes2 = xpath.select('//node()', doc);
assert.equal(7, nodes2.length);
assert.strictEqual(7, nodes2.length);
var pis = xpath.select("/processing-instruction('series')", doc);
assert.equal(2, pis.length);
assert.equal('books="7"', pis[1].data);
assert.strictEqual(2, pis.length);
assert.strictEqual('books="7"', pis[1].data);
});

@@ -66,3 +66,3 @@ });

assert.equal('title', xpath.select('//title[1]', doc)[0].localName);
assert.strictEqual('title', xpath.select('//title[1]', doc)[0].localName);
});

@@ -90,8 +90,8 @@

var nodes = xpath.select('//*[local-name(.)="title" and namespace-uri(.)="myns"]', doc);
assert.equal('title', nodes[0].localName);
assert.equal('myns', nodes[0].namespaceURI);
assert.strictEqual('title', nodes[0].localName);
assert.strictEqual('myns', nodes[0].namespaceURI);
var nodes2 = xpath.select('/*/title', doc);
assert.equal(0, nodes2.length);
assert.strictEqual(0, nodes2.length);
});

@@ -113,9 +113,9 @@

var nodes = xpath.selectWithResolver('//testns:title/text()', doc, resolver);
assert.equal('Harry Potter', nodes[0].nodeValue);
assert.strictEqual('Harry Potter', nodes[0].nodeValue);
assert.equal('JKR', xpath.selectWithResolver('//testns:field[@testns:type="author"]/text()', doc, resolver)[0].nodeValue);
assert.strictEqual('JKR', xpath.selectWithResolver('//testns:field[@testns:type="author"]/text()', doc, resolver)[0].nodeValue);
var nodes2 = xpath.selectWithResolver('/*/testns:*', doc, resolver);
assert.equal(2, nodes2.length);
assert.strictEqual(2, nodes2.length);
});

@@ -137,4 +137,4 @@

var nodes = xpath.selectWithResolver('//testns:title/text()', doc, resolver);
assert.equal('Harry Potter', xpath.selectWithResolver('//testns:title/text()', doc, resolver)[0].nodeValue);
assert.equal('JKR', xpath.selectWithResolver('//testns:field[@type="author"]/text()', doc, resolver)[0].nodeValue);
assert.strictEqual('Harry Potter', xpath.selectWithResolver('//testns:title/text()', doc, resolver)[0].nodeValue);
assert.strictEqual('JKR', xpath.selectWithResolver('//testns:field[@type="author"]/text()', doc, resolver)[0].nodeValue);
});

@@ -156,5 +156,5 @@

var nodes = xpath.selectWithResolver('//ns:title/text()', doc, resolver);
assert.equal('Harry Potter', nodes[0].nodeValue);
assert.strictEqual('Harry Potter', nodes[0].nodeValue);
assert.equal('JKR', xpath.selectWithResolver('//ns:field[@ns:type="author"]/text()', doc, resolver)[0].nodeValue);
assert.strictEqual('JKR', xpath.selectWithResolver('//ns:field[@ns:type="author"]/text()', doc, resolver)[0].nodeValue);
});

@@ -167,4 +167,4 @@

assert.equal('Harry Potter', select('//testns:title/text()', doc)[0].nodeValue);
assert.equal('JKR', select('//testns:field[@testns:type="author"]/text()', doc)[0].nodeValue);
assert.strictEqual('Harry Potter', select('//testns:title/text()', doc)[0].nodeValue);
assert.strictEqual('JKR', select('//testns:field[@testns:type="author"]/text()', doc)[0].nodeValue);
});

@@ -177,3 +177,3 @@

var author = xpath.select1('/author/@name', doc).value;
assert.equal('J. K. Rowling', author);
assert.strictEqual('J. K. Rowling', author);
});

@@ -189,4 +189,4 @@ });

assert.equal(1, characters.length);
assert.equal('Snape', characters[0].textContent);
assert.strictEqual(1, characters.length);
assert.strictEqual('Snape', characters[0].textContent);
});

@@ -200,4 +200,4 @@

var authors = xpath.select('/authors/author/@name', doc);
assert.equal(2, authors.length);
assert.equal('J. K. Rowling', authors[0].value);
assert.strictEqual(2, authors.length);
assert.strictEqual('J. K. Rowling', authors[0].value);

@@ -209,6 +209,6 @@ // https://github.com/goto100/xpath/issues/41

assert.equal(3, values.length);
assert.equal("1", values[0]);
assert.equal("2", values[1]);
assert.equal("3", values[2]);
assert.strictEqual(3, values.length);
assert.strictEqual("1", values[0]);
assert.strictEqual("2", values[1]);
assert.strictEqual("3", values[2]);
});

@@ -223,5 +223,5 @@

// string should downcast to boolean
assert.equal(false, xpath.select1('"false" = false()'), '"false" = false()');
assert.equal(true, xpath.select1('"a" = true()'), '"a" = true()');
assert.equal(true, xpath.select1('"" = false()'), '"" = false()');
assert.strictEqual(false, xpath.select1('"false" = false()'), '"false" = false()');
assert.strictEqual(true, xpath.select1('"a" = true()'), '"a" = true()');
assert.strictEqual(true, xpath.select1('"" = false()'), '"" = false()');
});

@@ -263,3 +263,3 @@

assert.equal(xpath.select("count(preceding::chapter)", chapter), 4);
assert.strictEqual(xpath.select("count(preceding::chapter)", chapter), 4);
});

@@ -274,8 +274,8 @@

assert.equal(sorted.length, 3);
assert.equal(unsorted.length, 3);
assert.strictEqual(sorted.length, 3);
assert.strictEqual(unsorted.length, 3);
assert.equal(sorted[0].textContent, 'Harry');
assert.equal(sorted[1].textContent, 'Ron');
assert.equal(sorted[2].textContent, 'Hermione');
assert.strictEqual(sorted[0].textContent, 'Harry');
assert.strictEqual(sorted[1].textContent, 'Ron');
assert.strictEqual(sorted[2].textContent, 'Hermione');

@@ -296,8 +296,8 @@ assert.notEqual(sorted[0], unsorted[0], "first nodeset element equal");

assert.equal(houses.length, 2);
assert.strictEqual(houses.length, 2);
var houseNames = houses.map(function (node) { return node.getAttribute('name'); }).sort();
assert.equal(houseNames[0], 'Gryffindor');
assert.equal(houseNames[1], 'Ravenclaw');
assert.strictEqual(houseNames[0], 'Gryffindor');
assert.strictEqual(houseNames[1], 'Ravenclaw');
});

@@ -317,8 +317,8 @@

assert.equal(houses.length, 2);
assert.strictEqual(houses.length, 2);
var houseNames = houses.map(function (node) { return node.getAttribute('name'); }).sort();
assert.equal(houseNames[0], 'Gryffindor');
assert.equal(houseNames[1], 'Ravenclaw');
assert.strictEqual(houseNames[0], 'Gryffindor');
assert.strictEqual(houseNames[1], 'Ravenclaw');
});

@@ -376,21 +376,21 @@

assert.equal(2, chapters.length);
assert.equal('The vanishing glass', chapters[0].textContent);
assert.equal("Dobby's warning", chapters[1].textContent);
assert.strictEqual(2, chapters.length);
assert.strictEqual('The vanishing glass', chapters[0].textContent);
assert.strictEqual("Dobby's warning", chapters[1].textContent);
var lastChapters = xpath.parse('/books/book/chapter[last()]').select({ node: doc });
assert.equal(2, lastChapters.length);
assert.equal('The vanishing glass', lastChapters[0].textContent);
assert.equal("The burrow", lastChapters[1].textContent);
assert.strictEqual(2, lastChapters.length);
assert.strictEqual('The vanishing glass', lastChapters[0].textContent);
assert.strictEqual("The burrow", lastChapters[1].textContent);
var secondChapter = xpath.parse('(/books/book/chapter)[2]').select({ node: doc });
assert.equal(1, secondChapter.length);
assert.equal('The vanishing glass', chapters[0].textContent);
assert.strictEqual(1, secondChapter.length);
assert.strictEqual('The vanishing glass', chapters[0].textContent);
var lastChapter = xpath.parse('(/books/book/chapter)[last()]').select({ node: doc });
assert.equal(1, lastChapter.length);
assert.equal("The burrow", lastChapter[0].textContent);
assert.strictEqual(1, lastChapter.length);
assert.strictEqual("The burrow", lastChapter[0].textContent);
});

@@ -406,3 +406,3 @@ });

assert.equal('Harry Potter', xpath.select1('string()', doc));
assert.strictEqual('Harry Potter', xpath.select1('string()', doc));
});

@@ -421,9 +421,9 @@

assert.equal(testValue, xpath.select1("string()", docFragment));
assert.strictEqual(testValue, xpath.select1("string()", docFragment));
});
it('should work correctly on boolean values', () => {
assert.equal('string', typeof xpath.select1('string(true())'));
assert.equal('string', typeof xpath.select1('string(false())'));
assert.equal('string', typeof xpath.select1('string(1 = 2)'));
assert.strictEqual('string', typeof xpath.select1('string(true())'));
assert.strictEqual('string', typeof xpath.select1('string(false())'));
assert.strictEqual('string', typeof xpath.select1('string(1 = 2)'));
assert.ok(xpath.select1('"true" = string(true())'), '"true" = string(true())');

@@ -433,3 +433,3 @@ });

it('should work correctly on numbers', () => {
assert.equal('string', typeof xpath.select1('string(45)'));
assert.strictEqual('string', typeof xpath.select1('string(45)'));
assert.ok(xpath.select1('"45" = string(45)'), '"45" = string(45)');

@@ -441,10 +441,10 @@ });

it('should convert strings to numbers correctly', () => {
assert.equal(45.2, xpath.select1('number("45.200")'));
assert.equal(55.0, xpath.select1('number("000055")'));
assert.equal(65.0, xpath.select1('number(" 65 ")'));
assert.strictEqual(45.2, xpath.select1('number("45.200")'));
assert.strictEqual(55.0, xpath.select1('number("000055")'));
assert.strictEqual(65.0, xpath.select1('number(" 65 ")'));
assert.equal(true, xpath.select1('"" != 0'), '"" != 0');
assert.equal(false, xpath.select1('"" = 0'), '"" = 0');
assert.equal(false, xpath.select1('0 = ""'), '0 = ""');
assert.equal(false, xpath.select1('0 = " "'), '0 = " "');
assert.strictEqual(true, xpath.select1('"" != 0'), '"" != 0');
assert.strictEqual(false, xpath.select1('"" = 0'), '"" = 0');
assert.strictEqual(false, xpath.select1('0 = ""'), '0 = ""');
assert.strictEqual(false, xpath.select1('0 = " "'), '0 = " "');

@@ -458,4 +458,4 @@ assert.ok(Number.isNaN(xpath.select('number("")')), 'number("")');

it('should convert numbers to strings correctly', () => {
assert.equal('0.0000000000000000000000005250000000000001', xpath.parse('0.525 div 1000000 div 1000000 div 1000000 div 1000000').evaluateString());
assert.equal('525000000000000000000000', xpath.parse('0.525 * 1000000 * 1000000 * 1000000 * 1000000').evaluateString());
assert.strictEqual('0.0000000000000000000000005250000000000001', xpath.parse('0.525 div 1000000 div 1000000 div 1000000 div 1000000').evaluateString());
assert.strictEqual('525000000000000000000000', xpath.parse('0.525 * 1000000 * 1000000 * 1000000 * 1000000').evaluateString());
});

@@ -472,6 +472,6 @@

assert.equal(person1, 'Harry Potter');
assert.equal(person2, 'Harry Potter');
assert.equal(person3, 'Harry Potter');
assert.equal(person4, 'Ron Weasley');
assert.strictEqual(person1, 'Harry Potter');
assert.strictEqual(person2, 'Harry Potter');
assert.strictEqual(person3, 'Harry Potter');
assert.strictEqual(person4, 'Ron Weasley');
});

@@ -490,9 +490,9 @@

assert.equal(allText, "Harry Potter & the Philosopher's StoneHarry Potter");
assert.equal(ns, 'http://harry');
assert.equal(title, "Harry Potter & the Philosopher's Stone");
assert.equal(child, "Harry Potter & the Philosopher's Stone");
assert.equal(titleLang, 'en');
assert.equal(pi.trim(), "name='J.K. Rowling'");
assert.equal(comment, ' This describes the Harry Potter Book ');
assert.strictEqual(allText, "Harry Potter & the Philosopher's StoneHarry Potter");
assert.strictEqual(ns, 'http://harry');
assert.strictEqual(title, "Harry Potter & the Philosopher's Stone");
assert.strictEqual(child, "Harry Potter & the Philosopher's Stone");
assert.strictEqual(titleLang, 'en');
assert.strictEqual(pi.trim(), "name='J.K. Rowling'");
assert.strictEqual(comment, ' This describes the Harry Potter Book ');
});

@@ -503,7 +503,7 @@

assert.equal(num, 0);
assert.strictEqual(num, 0);
var str = xpath.select('substring("expelliarmus", 1, "a" = "a")');
assert.equal(str, 'e');
assert.strictEqual(str, 'e');
});

@@ -516,10 +516,10 @@ });

assert.equal(typeof parsed, "object", "parse() should return an object");
assert.equal(typeof parsed.evaluate, "function", "parsed.evaluate should be a function");
assert.equal(typeof parsed.evaluateNumber, "function", "parsed.evaluateNumber should be a function");
assert.strictEqual(typeof parsed, "object", "parse() should return an object");
assert.strictEqual(typeof parsed.evaluate, "function", "parsed.evaluate should be a function");
assert.strictEqual(typeof parsed.evaluateNumber, "function", "parsed.evaluateNumber should be a function");
assert.equal(parsed.evaluateNumber(), 12);
assert.strictEqual(parsed.evaluateNumber(), 12);
// evaluating twice should yield the same result
assert.equal(parsed.evaluateNumber(), 12);
assert.strictEqual(parsed.evaluateNumber(), 12);
});

@@ -532,11 +532,11 @@

assert.equal(typeof parsed, 'object', 'parse() should return an object');
assert.strictEqual(typeof parsed, 'object', 'parse() should return an object');
assert.equal(typeof parsed.select1, 'function', 'parsed.select1 should be a function');
assert.strictEqual(typeof parsed.select1, 'function', 'parsed.select1 should be a function');
var single = parsed.select1({ node: doc });
assert.equal('title', single.localName);
assert.equal('Harry Potter', single.firstChild.data);
assert.equal('<title>Harry Potter</title>', single.toString());
assert.strictEqual('title', single.localName);
assert.strictEqual('Harry Potter', single.firstChild.data);
assert.strictEqual('<title>Harry Potter</title>', single.toString());
});

@@ -549,5 +549,5 @@

assert.equal(typeof parsed, 'object', 'parse() should return an object');
assert.strictEqual(typeof parsed, 'object', 'parse() should return an object');
assert.equal(typeof parsed.select, 'function', 'parsed.select should be a function');
assert.strictEqual(typeof parsed.select, 'function', 'parsed.select should be a function');

@@ -557,6 +557,6 @@ var nodes = parsed.select({ node: doc });

assert.ok(nodes, 'parsed.select() should return a value');
assert.equal(1, nodes.length);
assert.equal('title', nodes[0].localName);
assert.equal('Harry Potter', nodes[0].firstChild.data);
assert.equal('<title>Harry Potter</title>', nodes[0].toString());
assert.strictEqual(1, nodes.length);
assert.strictEqual('title', nodes[0].localName);
assert.strictEqual('Harry Potter', nodes[0].firstChild.data);
assert.strictEqual('<title>Harry Potter</title>', nodes[0].toString());
});

@@ -569,12 +569,12 @@

assert.equal(typeof parsed, 'object', 'parse() should return an object');
assert.strictEqual(typeof parsed, 'object', 'parse() should return an object');
assert.equal(typeof parsed.evaluateString, 'function', 'parsed.evaluateString should be a function');
assert.equal('7', parsed.evaluateString({ node: doc }));
assert.strictEqual(typeof parsed.evaluateString, 'function', 'parsed.evaluateString should be a function');
assert.strictEqual('7', parsed.evaluateString({ node: doc }));
assert.equal(typeof parsed.evaluateBoolean, 'function', 'parsed.evaluateBoolean should be a function');
assert.equal(true, parsed.evaluateBoolean({ node: doc }));
assert.strictEqual(typeof parsed.evaluateBoolean, 'function', 'parsed.evaluateBoolean should be a function');
assert.strictEqual(true, parsed.evaluateBoolean({ node: doc }));
assert.equal(typeof parsed.evaluateNumber, 'function', 'parsed.evaluateNumber should be a function');
assert.equal(7, parsed.evaluateNumber({ node: doc }));
assert.strictEqual(typeof parsed.evaluateNumber, 'function', 'parsed.evaluateNumber should be a function');
assert.strictEqual(7, parsed.evaluateNumber({ node: doc }));
});

@@ -591,13 +591,13 @@

assert.equal(false, evaluate('/*/myrtle'), 'boolean value of empty node set should be false');
assert.strictEqual(false, evaluate('/*/myrtle'), 'boolean value of empty node set should be false');
assert.equal(true, evaluate('not(/*/myrtle)'), 'not() of empty nodeset should be true');
assert.strictEqual(true, evaluate('not(/*/myrtle)'), 'not() of empty nodeset should be true');
assert.equal(true, evaluate('/*/title'), 'boolean value of non-empty nodeset should be true');
assert.strictEqual(true, evaluate('/*/title'), 'boolean value of non-empty nodeset should be true');
assert.equal(true, evaluate('/*/title = "Harry Potter"'), 'title equals Harry Potter');
assert.strictEqual(true, evaluate('/*/title = "Harry Potter"'), 'title equals Harry Potter');
assert.equal(false, evaluate('/*/title != "Harry Potter"'), 'title != Harry Potter should be false');
assert.strictEqual(false, evaluate('/*/title != "Harry Potter"'), 'title != Harry Potter should be false');
assert.equal(false, evaluate('/*/title = "Percy Jackson"'), 'title should not equal Percy Jackson');
assert.strictEqual(false, evaluate('/*/title = "Percy Jackson"'), 'title should not equal Percy Jackson');
});

@@ -627,4 +627,4 @@

assert.equal('Myrtle', value, description + ' - string value - ' + value);
assert.equal(2, count, description + ' map - count - ' + count);
assert.strictEqual('Myrtle', value, description + ' - string value - ' + value);
assert.strictEqual(2, count, description + ' map - count - ' + count);
} catch (e) {

@@ -663,3 +663,3 @@ e.message = description + ': ' + (e.message || '');

function doubleString(context, value) {
assert.equal(2, arguments.length);
assert.strictEqual(2, arguments.length);
var str = value.stringValue();

@@ -680,3 +680,3 @@ return str + str;

var expected = 'Harry PotterHarry Potter is cool';
assert.equal(expected, actual, description + ' - ' + expected + ' != ' + actual);
assert.strictEqual(expected, actual, description + ' - ' + expected + ' != ' + actual);
} catch (e) {

@@ -729,3 +729,3 @@ e.message = description + ": " + (e.message || '');

return function (context, value) {
assert.equal(2, arguments.length);
assert.strictEqual(2, arguments.length);
var str = value.stringValue();

@@ -742,3 +742,3 @@ return str + str;

return function (context, l, r) {
assert.equal(3, arguments.length);
assert.strictEqual(3, arguments.length);
var lbool = l.booleanValue();

@@ -761,12 +761,12 @@ var rbool = r.booleanValue();

assert.equal('Harry PotterHarry Potter is 2 cool 4 school', parsed.evaluateString(context));
assert.strictEqual('Harry PotterHarry Potter is 2 cool 4 school', parsed.evaluateString(context));
assert.equal(false, xpath.parse('hp:xor(false(), false())').evaluateBoolean(context));
assert.equal(true, xpath.parse('hp:xor(false(), true())').evaluateBoolean(context));
assert.equal(true, xpath.parse('hp:xor(true(), false())').evaluateBoolean(context));
assert.equal(false, xpath.parse('hp:xor(true(), true())').evaluateBoolean(context));
assert.strictEqual(false, xpath.parse('hp:xor(false(), false())').evaluateBoolean(context));
assert.strictEqual(true, xpath.parse('hp:xor(false(), true())').evaluateBoolean(context));
assert.strictEqual(true, xpath.parse('hp:xor(true(), false())').evaluateBoolean(context));
assert.strictEqual(false, xpath.parse('hp:xor(true(), true())').evaluateBoolean(context));
assert.equal('Hermione', xpath.parse('hp:second(/*/friend)').evaluateString(context));
assert.equal(1, xpath.parse('count(hp:second(/*/friend))').evaluateNumber(context));
assert.equal(0, xpath.parse('count(hp:second(/*/friendz))').evaluateNumber(context));
assert.strictEqual('Hermione', xpath.parse('hp:second(/*/friend)').evaluateString(context));
assert.strictEqual(1, xpath.parse('count(hp:second(/*/friend))').evaluateNumber(context));
assert.strictEqual(0, xpath.parse('count(hp:second(/*/friendz))').evaluateNumber(context));
});

@@ -790,5 +790,5 @@

try {
assert.equal(true, xpath.parse('$title = /*/title').evaluateBoolean(context));
assert.equal(false, xpath.parse('$notTitle = /*/title').evaluateBoolean(context));
assert.equal(11, xpath.parse('$houses + /*/volumes').evaluateNumber(context));
assert.strictEqual(true, xpath.parse('$title = /*/title').evaluateBoolean(context));
assert.strictEqual(false, xpath.parse('$notTitle = /*/title').evaluateBoolean(context));
assert.strictEqual(11, xpath.parse('$houses + /*/volumes').evaluateNumber(context));
} catch (e) {

@@ -847,6 +847,6 @@ e.message = description + ": " + (e.message || '');

assert.equal(true, xpath.parse('$hp:title = /*/title').evaluateBoolean(context));
assert.equal(false, xpath.parse('$title = /*/title').evaluateBoolean(context));
assert.equal('World', xpath.parse('$title').evaluateString(context));
assert.equal(false, xpath.parse('$hp:false').evaluateBoolean(context));
assert.strictEqual(true, xpath.parse('$hp:title = /*/title').evaluateBoolean(context));
assert.strictEqual(false, xpath.parse('$title = /*/title').evaluateBoolean(context));
assert.strictEqual('World', xpath.parse('$title').evaluateString(context));
assert.strictEqual(false, xpath.parse('$hp:false').evaluateBoolean(context));
assert.notEqual(false, xpath.parse('$hp:falseStr').evaluateBoolean(context));

@@ -865,19 +865,19 @@ assert.throws(function () {

assert.equal(simpleStep.toString(), 'child::my:book');
assert.strictEqual(simpleStep.toString(), 'child::my:book');
var precedingSib = parser.parse('preceding-sibling::my:chapter');
assert.equal(precedingSib.toString(), 'preceding-sibling::my:chapter');
assert.strictEqual(precedingSib.toString(), 'preceding-sibling::my:chapter');
var withPredicates = parser.parse('book[number > 3][contains(title, "and the")]');
assert.equal(withPredicates.toString(), "child::book[(child::number > 3)][contains(child::title, 'and the')]");
assert.strictEqual(withPredicates.toString(), "child::book[(child::number > 3)][contains(child::title, 'and the')]");
var parenthesisWithPredicate = parser.parse('(/books/book/chapter)[7]');
assert.equal(parenthesisWithPredicate.toString(), '(/child::books/child::book/child::chapter)[7]');
assert.strictEqual(parenthesisWithPredicate.toString(), '(/child::books/child::book/child::chapter)[7]');
var charactersOver20 = parser.parse('heroes[age > 20] | villains[age > 20]');
assert.equal(charactersOver20.toString(), 'child::heroes[(child::age > 20)] | child::villains[(child::age > 20)]');
assert.strictEqual(charactersOver20.toString(), 'child::heroes[(child::age > 20)] | child::villains[(child::age > 20)]');
});

@@ -903,3 +903,3 @@ });

assert.equal(0, greetings1.length);
assert.strictEqual(0, greetings1.length);

@@ -911,8 +911,8 @@ var allowAnyNamespaceOptions = { node: docHtml, allowAnyNamespaceForNoPrefix: true };

assert.equal(1, greetings2.length);
assert.equal('Hi Hermione!', greetings2[0].textContent);
assert.strictEqual(1, greetings2.length);
assert.strictEqual('Hi Hermione!', greetings2[0].textContent);
var allGreetings = xpath.parse('/html/body/p').select(allowAnyNamespaceOptions);
assert.equal(2, allGreetings.length);
assert.strictEqual(2, allGreetings.length);

@@ -927,3 +927,3 @@ var nsm = { html: xhtmlNs, other: 'http://www.example.com/other' };

assert.equal(2, greetings3.length);
assert.strictEqual(2, greetings3.length);

@@ -946,3 +946,3 @@ var badPrefixPath = xpath.parse('/html:html/other:body/html:p');

assert.equal(2, greetings1.length);
assert.strictEqual(2, greetings1.length);

@@ -952,3 +952,3 @@ // allow case insensitive match

assert.equal(2, greetings2.length);
assert.strictEqual(2, greetings2.length);

@@ -958,3 +958,3 @@ // non-html mode: allow select if case and namespaces match

assert.equal(2, greetings3.length);
assert.strictEqual(2, greetings3.length);

@@ -964,3 +964,3 @@ // non-html mode: require namespaces

assert.equal(0, greetings4.length);
assert.strictEqual(0, greetings4.length);

@@ -970,3 +970,3 @@ // non-html mode: require case to match

assert.equal(0, greetings5.length);
assert.strictEqual(0, greetings5.length);
});

@@ -1004,4 +1004,4 @@ });

assert.equal(andTheBooks.length, 2);
assert.equal(secretBooks.length, 1);
assert.strictEqual(andTheBooks.length, 2);
assert.strictEqual(secretBooks.length, 1);
});

@@ -1012,3 +1012,3 @@

assert.equal('Heyy', translated);
assert.strictEqual('Heyy', translated);

@@ -1019,10 +1019,10 @@ var characters = new dom().parseFromString('<characters><character>Harry</character><character>Ron</character><character>Hermione</character></characters>');

assert.equal(2, firstTwo.length);
assert.equal('Harry', firstTwo[0].textContent);
assert.equal('Ron', firstTwo[1].textContent);
assert.strictEqual(2, firstTwo.length);
assert.strictEqual('Harry', firstTwo[0].textContent);
assert.strictEqual('Ron', firstTwo[1].textContent);
var last = xpath.parse('/characters/character[last()]').select({ node: characters });
assert.equal(1, last.length);
assert.equal('Hermione', last[0].textContent);
assert.strictEqual(1, last.length);
assert.strictEqual('Hermione', last[0].textContent);
});

@@ -1049,2 +1049,6 @@ });

assert.ok(xpath.NodeTest, "xpath.NodeTest");
assert.ok(xpath.OrOperation, "xpath.OrOperation");
assert.ok(xpath.AndOperation, "xpath.AndOperation");
assert.ok(xpath.BarOperation, "xpath.BarOperation");

@@ -1072,5 +1076,5 @@

assert.equal(xpath.select1('local-name(/book/characters)', doc), 'characters');
assert.strictEqual(xpath.select1('local-name(/book/characters)', doc), 'characters');
});
});
});

Sorry, the diff of this file is too big to display

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