New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openstax/highlighter

Package Overview
Dependencies
Maintainers
3
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openstax/highlighter - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

2

package.json
{
"name": "@openstax/highlighter",
"version": "1.1.6",
"version": "1.1.7",
"main": "dist/highlighter.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -7,2 +7,3 @@ import {DATA_ATTR} from '../../injectHighlightWrappers';

const isText = node => node && node.nodeType === 3;
const isTextOrTextHighlight = node => isText(node) || isTextHighlight(node);
const isElement = node => node && node.nodeType === 1;

@@ -18,5 +19,5 @@ const isTextOrElement = node => isText(node) || isElement(node);

// if the range offset designates a text highlight we need to move the target to the highlight
// if the range offset designates text or a text highlight we need to move the target
// so text offset stuff will work
if (isElement(targetElement) && isTextHighlight(targetElement.childNodes[offset])) {
if (isElement(targetElement) && isTextOrTextHighlight(targetElement.childNodes[offset])) {
targetElement = targetElement.childNodes[offset];

@@ -23,0 +24,0 @@ offset = 0;

@@ -224,2 +224,14 @@ import {DATA_ATTR} from '../../injectHighlightWrappers';

it('if target specifies the end of a highlight, move it ', () => {
document.body.innerHTML = `
<div id="reference">qwer <span ${DATA_ATTR}>asdf</span> werewwer</div>
`;
const reference = document.getElementById('reference');
const [result, offset] = xpath.getXPathForElement(reference, 2, reference);
expect(result).toEqual("./text()[1]");
expect(offset).toEqual(9);
});
it('modifies offset for element target when treating text nodes separated by highlight as one', () => {

@@ -226,0 +238,0 @@ document.body.innerHTML = `

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