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

@wordpress/dom

Package Overview
Dependencies
Maintainers
15
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/dom - npm Package Compare versions

Comparing version 2.13.0 to 2.13.1

20

build-module/dom.js

@@ -418,18 +418,6 @@ /**

export function isTextField(element) {
try {
var nodeName = element.nodeName,
selectionStart = element.selectionStart,
contentEditable = element.contentEditable;
return nodeName === 'INPUT' && selectionStart !== null || nodeName === 'TEXTAREA' || contentEditable === 'true';
} catch (error) {
// Safari throws an exception when trying to get `selectionStart`
// on non-text <input> elements (which, understandably, don't
// have the text selection API). We catch this via a try/catch
// block, as opposed to a more explicit check of the element's
// input types, because of Safari's non-standard behavior. This
// also means we don't have to worry about the list of input
// types that support `selectionStart` changing as the HTML spec
// evolves over time.
return false;
}
var nodeName = element.nodeName,
contentEditable = element.contentEditable;
var nonTextInputs = ['button', 'checkbox', 'hidden', 'file', 'radio', 'image', 'range', 'reset', 'submit', 'number'];
return nodeName === 'INPUT' && !nonTextInputs.includes(element.type) || nodeName === 'TEXTAREA' || contentEditable === 'true';
}

@@ -436,0 +424,0 @@ /**

@@ -452,18 +452,6 @@ "use strict";

function isTextField(element) {
try {
var nodeName = element.nodeName,
selectionStart = element.selectionStart,
contentEditable = element.contentEditable;
return nodeName === 'INPUT' && selectionStart !== null || nodeName === 'TEXTAREA' || contentEditable === 'true';
} catch (error) {
// Safari throws an exception when trying to get `selectionStart`
// on non-text <input> elements (which, understandably, don't
// have the text selection API). We catch this via a try/catch
// block, as opposed to a more explicit check of the element's
// input types, because of Safari's non-standard behavior. This
// also means we don't have to worry about the list of input
// types that support `selectionStart` changing as the HTML spec
// evolves over time.
return false;
}
var nodeName = element.nodeName,
contentEditable = element.contentEditable;
var nonTextInputs = ['button', 'checkbox', 'hidden', 'file', 'radio', 'image', 'range', 'reset', 'submit', 'number'];
return nodeName === 'INPUT' && !nonTextInputs.includes(element.type) || nodeName === 'TEXTAREA' || contentEditable === 'true';
}

@@ -470,0 +458,0 @@ /**

4

package.json
{
"name": "@wordpress/dom",
"version": "2.13.0",
"version": "2.13.1",
"description": "DOM utilities module for WordPress.",

@@ -33,3 +33,3 @@ "author": "The WordPress Contributors",

},
"gitHead": "381a42b62e157d0e7fd6366cc51b0f5725990044"
"gitHead": "862bb53a4af8aa5852a22445b5d12591d5500e52"
}

@@ -451,21 +451,20 @@ /**

export function isTextField( element ) {
try {
const { nodeName, selectionStart, contentEditable } = element;
return (
( nodeName === 'INPUT' && selectionStart !== null ) ||
nodeName === 'TEXTAREA' ||
contentEditable === 'true'
);
} catch ( error ) {
// Safari throws an exception when trying to get `selectionStart`
// on non-text <input> elements (which, understandably, don't
// have the text selection API). We catch this via a try/catch
// block, as opposed to a more explicit check of the element's
// input types, because of Safari's non-standard behavior. This
// also means we don't have to worry about the list of input
// types that support `selectionStart` changing as the HTML spec
// evolves over time.
return false;
}
const { nodeName, contentEditable } = element;
const nonTextInputs = [
'button',
'checkbox',
'hidden',
'file',
'radio',
'image',
'range',
'reset',
'submit',
'number',
];
return (
( nodeName === 'INPUT' && ! nonTextInputs.includes( element.type ) ) ||
nodeName === 'TEXTAREA' ||
contentEditable === 'true'
);
}

@@ -472,0 +471,0 @@

@@ -110,5 +110,8 @@ /**

'checkbox',
'image',
'hidden',
'file',
'radio',
'image',
'range',
'reset',
'submit',

@@ -122,3 +125,9 @@ ];

*/
const TEXT_INPUT_TYPES = [ 'text', 'password', 'search', 'url' ];
const TEXT_INPUT_TYPES = [
'text',
'password',
'search',
'url',
'email',
];

@@ -125,0 +134,0 @@ it( 'should return false for non-text input elements', () => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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