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

scribe-editor

Package Overview
Dependencies
Maintainers
9
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scribe-editor - npm Package Compare versions

Comparing version 1.2.5 to 1.2.7

11

BROWSERINCONSISTENCIES.md

@@ -101,1 +101,12 @@ ## List of `contenteditable` Browser Inconsistencies

http://jsbin.com/xoqul/1/edit?js,console,output
### `Selection.getRangeAt`
* Chrome (< 42): Selection.getRangeAt() returns an incorrect range when in shadow DOM
https://code.google.com/p/chromium/issues/detail?id=380690
### `Selection.isCollapsed`
* Chrome: Selection.isCollapsed is incorrect when in shadow DOM
https://code.google.com/p/chromium/issues/detail?id=447523
http://jsfiddle.net/7zgegoda/2/

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 1.2.7
ShadowDOM fixes for Chrome from [ShaunNetherby](https://github.com/shaunnetherby), thanks
# 1.2.5

@@ -2,0 +6,0 @@

2

package.json
{
"name": "scribe-editor",
"version": "1.2.5",
"version": "1.2.7",
"main": "src/scribe.js",

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

@@ -13,6 +13,22 @@ define([

function Selection() {
this.selection = window.getSelection();
var rootDoc = document;
// find the parent document or document fragment
var currentElement = scribe.el.parentNode;
while(currentElement && currentElement.nodeType !== Node.DOCUMENT_FRAGMENT_NODE && currentElement.nodeType !== Node.DOCUMENT_NODE) {
currentElement = currentElement.parentNode;
}
// if we found a document fragment and it has a getSelection method, set it to the root doc
if (currentElement && currentElement.nodeType === Node.DOCUMENT_FRAGMENT_NODE && currentElement.getSelection) {
rootDoc = currentElement;
}
this.selection = rootDoc.getSelection();
if (this.selection.rangeCount) {
this.range = this.selection.getRangeAt(0);
// create the range to avoid chrome bug from getRangeAt / window.getSelection()
// https://code.google.com/p/chromium/issues/detail?id=380690
this.range = document.createRange();
this.range.setStart(this.selection.anchorNode, this.selection.anchorOffset);
this.range.setEnd(this.selection.focusNode, this.selection.focusOffset);
}

@@ -136,4 +152,4 @@ }

if (! this.selection.isCollapsed) {
// using range.collapsed vs selection.isCollapsed - https://code.google.com/p/chromium/issues/detail?id=447523
if (! this.range.collapsed) {
// Start marker

@@ -140,0 +156,0 @@ var rangeStart = this.range.cloneRange();

@@ -17,3 +17,4 @@ define(function () {

*/
if (selection.selection.isCollapsed) {
// using range.collapsed vs selection.isCollapsed - https://code.google.com/p/chromium/issues/detail?id=447523
if (selection.range.collapsed) {
var aElement = document.createElement('a');

@@ -20,0 +21,0 @@ aElement.setAttribute('href', value);

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