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

openrosa-xpath-evaluator

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openrosa-xpath-evaluator - npm Package Compare versions

Comparing version 2.0.12 to 2.0.13

test/integration/attributes.spec.js

1

.eslintrc.json

@@ -13,4 +13,5 @@ {

"rules": {
"eol-last": ["error", "always"],
"semi": [ "error", "always" ]
}
}

@@ -6,2 +6,9 @@ Change Log

[2.0.13] - 2022-10-26
----------------------
##### Fixed
- Correctly evaluate absolute nodeset expressions with an attribute context node in any browser
[2.0.12] - 2022-09-16

@@ -8,0 +15,0 @@ ----------------------

2

package.json
{
"name": "openrosa-xpath-evaluator",
"version": "2.0.12",
"version": "2.0.13",
"description": "Wrapper for browsers' XPath evaluator with added support for OpenRosa extensions.",

@@ -5,0 +5,0 @@ "homepage": "https://enketo.org",

@@ -115,2 +115,3 @@ const { handleOperation } = require('./utils/operation');

/**
* @type {typeof document.evaluate}
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate

@@ -249,3 +250,14 @@ */

} else {
pushToken(toInternalResult(wrapped.evaluate(expr, cN, nR, XPathResult.ANY_TYPE, null)));
// This addresses a bug in Chrome and Safari, where an absolute
// nodeset expression evaluated with an attribute contex node
// does not evaluate to that nodeset as expected. Using the
// attribute's owner document evaluates the expression correctly,
// ensuring consistent behavior between Chrome, Safari and Firefox.
const contextNode = (
cN?.nodeType === Node.ATTRIBUTE_NODE && expr.startsWith('/')
? cN.ownerDocument
: cN
);
pushToken(toInternalResult(wrapped.evaluate(expr, contextNode, nR, XPathResult.ANY_TYPE, null)));
}

@@ -252,0 +264,0 @@

@@ -6,4 +6,14 @@ (function registerDomGlobals() {

};
Node.ELEMENT_NODE = 1;
Object.assign(Node, {
ELEMENT_NODE: 1,
ATTRIBUTE_NODE: 2,
TEXT_NODE: 3,
CDATA_SECTION_NODE: 4,
PROCESSING_INSTRUCTION_NODE: 7,
COMMENT_NODE: 8,
DOCUMENT_NODE: 9,
DOCUMENT_TYPE_NODE: 10,
DOCUMENT_FRAGMENT_NODE: 11,
});
global.XPathResult = {

@@ -10,0 +20,0 @@ ANY_TYPE: 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