@cocreate/selection 1.5.6 → 1.5.7

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.5.7](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.5.6...v1.5.7) (2023-04-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * replaced substr with substring ([e51f5e6](https://github.com/CoCreate-app/CoCreate-selection/commit/e51f5e631dc6b5d7b0da3de10cc4371227d008b0))
7
+
1
8
  ## [1.5.6](https://github.com/CoCreate-app/CoCreate-selection/compare/v1.5.5...v1.5.6) (2023-04-11)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/selection",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "A simple selection component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "selection",
package/src/index.js CHANGED
@@ -170,8 +170,8 @@ export function hasSelection(el) {
170
170
 
171
171
  export function getElementPosition(str, start, end) {
172
172
  let response = {};
173
- let startString = str.substr(0, start);
174
- let endString = str.substr(start);
173
+ let startString = str.substring(0, start);
174
+ let endString = str.substring(start);
175
175
  let angleStart = startString.lastIndexOf("<");
176
176
  let angleEnd = startString.lastIndexOf(">");
177
177
  let endStringAngleEnd = endString.indexOf(">");
@@ -205,9 +205,9 @@ export function getElementPosition(str, start, end) {
205
205
  let node = str.slice(angleStart, startString.length + endStringAngleEnd + 1);
206
206
  if (node.startsWith("</")) {
207
207
  startNode = node.slice(0, 1) + node.slice(2);
208
- startNode = startNode.substr(0, startNode.length - 1);
208
+ startNode = startNode.substring(0, startNode.length - 1);
209
209
  nodeStart = startString.lastIndexOf(startNode);
210
- let endString1 = str.substr(nodeStart);
210
+ let endString1 = str.substring(nodeStart);
211
211
  let end = endString1.indexOf(">");
212
212
  nodeEnd = nodeStart + end + 1;
213
213
  type = 'isEndTag';
@@ -323,7 +323,7 @@ export function getStringPosition({string, target, position, attribute, property
323
323
  }
324
324
  else {
325
325
  start = getElFromString(dom, string, element, 'beforebegin');
326
- let elString = string.substr(start);
326
+ let elString = string.substring(start);
327
327
  let attrValue = element.getAttribute(attribute);
328
328
  let attrStart = elString.indexOf(` ${attribute}=`);
329
329
  start = start + attrStart;
@@ -339,7 +339,7 @@ export function getStringPosition({string, target, position, attribute, property
339
339
  if (prop && val){
340
340
  if (attrValue.includes(`${prop}:`)){
341
341
  let propStart = attrValue.indexOf(`${prop}:`);
342
- let propString = attrValue.substr(propStart);
342
+ let propString = attrValue.substring(propStart);
343
343
  let propEnd = propString.indexOf(" ");
344
344
  if (propEnd > 0)
345
345
  propString = propString.slice(0, propEnd);