Socket
Socket
Sign inDemoInstall

set-caret-position

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

set-caret-position - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

14

index.js
module.exports = function (inputField, caretPos) {
if (inputField.createTextRange) {
var range = inputField.createTextRange();
var element = document.getElementById(inputField);
if (element.createTextRange) {
var range = element.createTextRange();
range.move('character', caretPos);
range.select();
} else {
if (inputField.selectionStart || inputField.selectionStart === 0) {
inputField.focus();
inputField.setSelectionRange(caretPos, caretPos);
if (element.selectionStart || element.selectionStart === 0) {
element.focus();
element.setSelectionRange(caretPos, caretPos);
} else {
inputField.focus();
element.focus();
}
}
};
{
"name": "set-caret-position",
"version": "2.0.1",
"version": "3.0.0",
"description": "Move cursor to beginning of line below",

@@ -5,0 +5,0 @@ "main": "index.js",

var setCaretPosition = require('./index.js');
document = {
getElementById: function() {
return element;
}
};
var element = {

@@ -4,0 +11,0 @@ range: {

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