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

@vonage/vvd-foundation

Package Overview
Dependencies
Maintainers
14
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/vvd-foundation - npm Package Compare versions

Comparing version 0.10.0 to 0.11.0

34

CHANGELOG.md

@@ -1,4 +0,36 @@

# 0.10.0 (2020-09-22)
# [0.11.0](https://github.com/vonage/vivid/compare/v0.10.0...v0.11.0) (2020-09-29)
# [0.10.0](https://github.com/vonage/vivid/compare/v0.9.0...v0.10.0) (2020-09-22)
# [0.8.0](https://github.com/vonage/vivid/compare/v0.7.0...v0.8.0) (2020-09-22)
### Bug Fixes
* **button:** revert to hidden form button submit ([#318](https://github.com/vonage/vivid/issues/318)) ([1cb76e9](https://github.com/vonage/vivid/commit/1cb76e99bc814ec978108a1a3230f79b27b0294d))
### Features
* **form elements:** form association cleanup ([#321](https://github.com/vonage/vivid/issues/321)) ([a4f89d3](https://github.com/vonage/vivid/commit/a4f89d38861f7486c9f1fc142c873e0f1bb73efc))
* **foundation:** added helper function to allow submitting forms on key press ([#320](https://github.com/vonage/vivid/issues/320)) ([19e398c](https://github.com/vonage/vivid/commit/19e398c157ec577a3e553ea07649896932ed13bd))
# [0.7.0](https://github.com/vonage/vivid/compare/v0.6.0...v0.7.0) (2020-09-15)
# [0.6.0](https://github.com/vonage/vivid/compare/v0.5.0...v0.6.0) (2020-09-08)
### Features
* **textarea:** textarea form association ([#300](https://github.com/vonage/vivid/issues/300)) ([19ebd4e](https://github.com/vonage/vivid/commit/19ebd4e5f694738d2687f2a9d2a24ef2fa9beb4b))

@@ -0,1 +1,15 @@

function findClosestFormThroughShadow(element) {
while (element) {
const form = element.closest('form');
if (form) {
return form;
}
const root = element.getRootNode();
if (!root) {
return null;
}
element = root.host;
}
return null;
}
export function getFormByIdOrClosest(element) {

@@ -5,5 +19,5 @@ const formId = element.getAttribute('form');

? document.getElementById(formId)
: element.closest('form');
: findClosestFormThroughShadow(element);
return formElement instanceof HTMLFormElement ? formElement : null;
}
//# sourceMappingURL=common.js.map

18

form-association/request-submit.js

@@ -0,12 +1,16 @@

function isElementSubmit(element) {
return Boolean(element.getAttribute('type') === 'submit' ||
(element.nodeName === 'BUTTON' && element.getAttribute('type') === null));
}
function findFormSubmitButtons(form) {
const formElements = [...form.elements];
return formElements.filter(isElementSubmit);
}
export function requestSubmit(form) {
if (form.requestSubmit) {
form.requestSubmit();
const formSubmitButtons = findFormSubmitButtons(form);
if (!formSubmitButtons.length) {
return;
}
const fakeButton = document.createElement('button');
fakeButton.style.display = 'none';
form.appendChild(fakeButton);
fakeButton.click();
fakeButton.remove();
formSubmitButtons[0].click();
}
//# sourceMappingURL=request-submit.js.map
{
"name": "@vonage/vvd-foundation",
"version": "0.10.0",
"version": "0.11.0",
"description": "internal package to hold constants, definitions and primitives to be used in the rest of Vivid ecosystem",

@@ -28,3 +28,3 @@ "homepage": "https://github.com/Vonage/vivid/tree/master/components/foundation#readme",

},
"gitHead": "2aeca64a96ebdb3dfc61888430fea0f959c19090"
"gitHead": "ea9cd3a95a11dd0c281950329fb6c8b698903ab8"
}

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