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

datalist-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datalist-polyfill - npm Package Compare versions

Comparing version 1.21.0 to 1.21.1

2

bower.json

@@ -5,3 +5,3 @@ {

"A minimal and dependency-free vanilla JavaScript datalist polyfill. Supports all standard's functionality as well as mimics other browsers behavior.",
"version": "1.21.0",
"version": "1.21.1",
"homepage": "https://github.com/mfranzke/datalist-polyfill",

@@ -8,0 +8,0 @@ "authors": [

@@ -10,4 +10,10 @@ # Changelog

## [1.21.0] - 2018-08-07
## [1.21.1] - 2018-08-09
### Fixed
- Suggestions aren‘t working onclick any more (#GH-35)
## [1.21.0] - 2018-08-08
### Added

@@ -14,0 +20,0 @@

@@ -473,5 +473,6 @@ /*

if (
eventType !== 'blur' &&
(eventType === 'keydown' &&
(event.keyCode === keyENTER || event.key === 'Tab')) &&
(eventType === 'change' ||
eventType === 'click' ||
(eventType === 'keydown' &&
(event.keyCode === keyENTER || event.key === 'Tab'))) &&
datalistSelect.value.length > 0 &&

@@ -478,0 +479,0 @@ datalistSelect.value !== datalist.title

@@ -6,2 +6,2 @@ /*

*/
!function(){"use strict";var e=window.document;if("list"in e.createElement("input")&&Boolean(e.createElement("datalist")&&window.HTMLDataListElement))return!1;!function(t){t&&t.prototype&&void 0===t.prototype.list&&Object.defineProperty(t.prototype,"list",{get:function(){return"object"==typeof this&&this instanceof t?e.querySelector("datalist#"+this.getAttribute("list")):null}})}(window.HTMLInputElement),function(e){e&&e.prototype&&void 0===e.prototype.options&&Object.defineProperty(e.prototype,"options",{get:function(){return"object"==typeof this&&this instanceof e?this.getElementsByTagName("option"):null}})}(window.HTMLElement),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector);var t=!1,i=13,n=27,r=38,l=40,a=" / ",o=["text","email","number","search","tel","url"],s="polyfilled",u="polyfilling";window.addEventListener("touchstart",function e(){t=!0,window.removeEventListener("touchstart",e)});var d=window.MutationObserver||window.WebKitMutationObserver,p;void 0!==d&&(p=new d(function(t){var i=!1;if(t.forEach(function(e){for(var t=0;t<e.addedNodes.length;++t)"datalist"===e.target.tagName.toLowerCase()&&(i=e.target)}),i){var n=e.querySelector('input[list="'+i.id+'"]');""!==n.value&&h(y(i,n).length,i.getElementsByClassName("polyfilling")[0])}}));var c=function(e){var i=e.target,n=i.list,r=n.getElementsByClassName("polyfilling")[0]||f(i,n);if("input"===i.tagName.toLowerCase()&&null!==n&&void 0!==r){var l=!1,a=38===e.keyCode||40===e.keyCode;if(27!==e.keyCode&&13!==e.keyCode&&(""!==i.value||a)){y(n,i).length>0&&(l=!0);var o=0,s=r.options.length-1;t?r.selectedIndex=0:a&&"number"!==i.getAttribute("type")&&(r.selectedIndex=38===e.keyCode?s:0,r.focus())}h(l,r)}},y=function(i,n){void 0!==p&&p.disconnect();var r=i.getElementsByClassName("polyfilling")[0]||f(n,i),l=n.value,a=e.createDocumentFragment(),o=e.createDocumentFragment();"email"===n.getAttribute("type")&&null!==n.getAttribute("multiple")&&(l=l.substring(l.lastIndexOf(",")+1)),Array.prototype.slice.call(i.querySelectorAll("option:not(:disabled)")).sort(function(e,t){var i=e.value,r=t.value;return"url"===n.getAttribute("type")&&(i=i.replace(/(^\w+:|^)\/\//,""),r=r.replace(/(^\w+:|^)\/\//,"")),i.localeCompare(r)}).forEach(function(e){var t=e.value;if(""!==t&&-1!==t.toLowerCase().indexOf(l.toLowerCase())&&!1===e.disabled){var i=e.getAttribute("label"),n=e.text,r=n.substr(0,t.length+" / ".length),s=t+" / ";n&&!i&&n!==t&&r!==s?e.innerText=t+" / "+n:e.text||(e.innerText=i||t),a.appendChild(e)}else o.appendChild(e)}),r.appendChild(a);var s=r.options.length;return r.size=s>10?10:s,r.multiple=!t&&s<2,(i.getElementsByClassName("ie9_fix")[0]||i).appendChild(o),void 0!==p&&p.observe(i,{childList:!0}),r.options},v=function(e){if(e.target.matches("input[list]")){var t=e.target,i=t.list;if("input"===t.tagName.toLowerCase()&&null!==i){var n=e.type,r=i.getElementsByClassName("polyfilling")[0]||f(t,i),l=r&&r.querySelector("option:not(:disabled)")&&("focusin"===n&&""!==t.value||e.relatedTarget&&e.relatedTarget===r);t.matches(".polyfilled")||(t.setAttribute("autocomplete","off"),t.setAttribute("role","textbox"),t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-owns",t.getAttribute("list")),"focusin"===n?(t.addEventListener("keyup",c),t.addEventListener("focusout",v,!0)):"blur"===n&&(t.removeEventListener("keyup",c),t.removeEventListener("focusout",v,!0)),t.className+=" polyfilled"),h(l,r)}}},f=function(i,n){if(-1!==o.indexOf(i.getAttribute("type"))&&null!==n){var r=i.getClientRects(),l=window.getComputedStyle(i),a=e.createElement("select");if(a.setAttribute("class","polyfilling"),a.style.position="absolute",h(!1,a),a.setAttribute("tabindex","-1"),a.setAttribute("aria-live","polite"),a.setAttribute("role","listbox"),t||a.setAttribute("aria-multiselectable","false"),"block"===l.getPropertyValue("display"))a.style.marginTop="-"+l.getPropertyValue("margin-bottom");else{var s="rtl"===l.getPropertyValue("direction")?"right":"left";a.style.setProperty("margin-"+s,"-"+(r[0].width+parseFloat(l.getPropertyValue("margin-"+s)))+"px"),a.style.marginTop=parseInt(r[0].height+(i.offsetTop-n.offsetTop),10)+"px"}if(a.style.borderRadius=l.getPropertyValue("border-radius"),a.style.minWidth=r[0].width+"px",t){var u=e.createElement("option");u.innerText=n.title,u.disabled=!0,u.setAttribute("class","message"),a.appendChild(u)}return n.appendChild(a),t?a.addEventListener("change",m):a.addEventListener("click",m),a.addEventListener("blur",m),a.addEventListener("keydown",m),a.addEventListener("keypress",g),a}},g=function(t){var i=t.target,n=i.parentNode,r=e.querySelector('input[list="'+n.id+'"]');"select"===i.tagName.toLowerCase()&&null!==r&&(!t.key||"Backspace"!==t.key&&1!==t.key.length||(r.focus(),"Backspace"===t.key?(r.value=r.value.substr(0,r.value.length-1),b(r)):r.value+=t.key,y(n,r)))},m=function(t){var i=t.currentTarget,n=i.parentNode,r=e.querySelector('input[list="'+n.id+'"]');if("select"===i.tagName.toLowerCase()&&null!==r){var l=t.type,a="keydown"===l&&13!==t.keyCode&&27!==t.keyCode;if("blur"!==l&&"keydown"===l&&(13===t.keyCode||"Tab"===t.key)&&i.value.length>0&&i.value!==n.title){var o;r.value="email"===r.getAttribute("type")&&null!==r.getAttribute("multiple")&&(o=r.value.lastIndexOf(","))>-1?r.value.slice(0,o)+","+i.value:r.value=i.value,b(r),"Tab"!==t.key&&r.focus(),a=!1}else"keydown"===l&&27===t.keyCode&&r.focus();h(a,i)}},b=function(t){var i;"function"==typeof Event?i=new Event("input",{bubbles:!0}):(i=e.createEvent("Event"),i.initEvent("input",!0,!1)),t.dispatchEvent(i)},h=function(t,i){t?i.removeAttribute("hidden"):i.setAttributeNode(e.createAttribute("hidden")),i.setAttribute("aria-hidden",(!t).toString())};e.addEventListener("focusin",v,!0)}();
!function(){"use strict";var e=window.document;if("list"in e.createElement("input")&&Boolean(e.createElement("datalist")&&window.HTMLDataListElement))return!1;!function(t){t&&t.prototype&&void 0===t.prototype.list&&Object.defineProperty(t.prototype,"list",{get:function(){return"object"==typeof this&&this instanceof t?e.querySelector("datalist#"+this.getAttribute("list")):null}})}(window.HTMLInputElement),function(e){e&&e.prototype&&void 0===e.prototype.options&&Object.defineProperty(e.prototype,"options",{get:function(){return"object"==typeof this&&this instanceof e?this.getElementsByTagName("option"):null}})}(window.HTMLElement),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector);var t=!1,i=13,n=27,l=38,r=40,a=" / ",o=["text","email","number","search","tel","url"],s="polyfilled",u="polyfilling";window.addEventListener("touchstart",function e(){t=!0,window.removeEventListener("touchstart",e)});var d=window.MutationObserver||window.WebKitMutationObserver,p;void 0!==d&&(p=new d(function(t){var i=!1;if(t.forEach(function(e){for(var t=0;t<e.addedNodes.length;++t)"datalist"===e.target.tagName.toLowerCase()&&(i=e.target)}),i){var n=e.querySelector('input[list="'+i.id+'"]');""!==n.value&&h(y(i,n).length,i.getElementsByClassName("polyfilling")[0])}}));var c=function(e){var i=e.target,n=i.list,l=n.getElementsByClassName("polyfilling")[0]||f(i,n);if("input"===i.tagName.toLowerCase()&&null!==n&&void 0!==l){var r=!1,a=38===e.keyCode||40===e.keyCode;if(27!==e.keyCode&&13!==e.keyCode&&(""!==i.value||a)){y(n,i).length>0&&(r=!0);var o=0,s=l.options.length-1;t?l.selectedIndex=0:a&&"number"!==i.getAttribute("type")&&(l.selectedIndex=38===e.keyCode?s:0,l.focus())}h(r,l)}},y=function(i,n){void 0!==p&&p.disconnect();var l=i.getElementsByClassName("polyfilling")[0]||f(n,i),r=n.value,a=e.createDocumentFragment(),o=e.createDocumentFragment();"email"===n.getAttribute("type")&&null!==n.getAttribute("multiple")&&(r=r.substring(r.lastIndexOf(",")+1)),Array.prototype.slice.call(i.querySelectorAll("option:not(:disabled)")).sort(function(e,t){var i=e.value,l=t.value;return"url"===n.getAttribute("type")&&(i=i.replace(/(^\w+:|^)\/\//,""),l=l.replace(/(^\w+:|^)\/\//,"")),i.localeCompare(l)}).forEach(function(e){var t=e.value;if(""!==t&&-1!==t.toLowerCase().indexOf(r.toLowerCase())&&!1===e.disabled){var i=e.getAttribute("label"),n=e.text,l=n.substr(0,t.length+" / ".length),s=t+" / ";n&&!i&&n!==t&&l!==s?e.innerText=t+" / "+n:e.text||(e.innerText=i||t),a.appendChild(e)}else o.appendChild(e)}),l.appendChild(a);var s=l.options.length;return l.size=s>10?10:s,l.multiple=!t&&s<2,(i.getElementsByClassName("ie9_fix")[0]||i).appendChild(o),void 0!==p&&p.observe(i,{childList:!0}),l.options},v=function(e){if(e.target.matches("input[list]")){var t=e.target,i=t.list;if("input"===t.tagName.toLowerCase()&&null!==i){var n=e.type,l=i.getElementsByClassName("polyfilling")[0]||f(t,i),r=l&&l.querySelector("option:not(:disabled)")&&("focusin"===n&&""!==t.value||e.relatedTarget&&e.relatedTarget===l);t.matches(".polyfilled")||(t.setAttribute("autocomplete","off"),t.setAttribute("role","textbox"),t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-owns",t.getAttribute("list")),"focusin"===n?(t.addEventListener("keyup",c),t.addEventListener("focusout",v,!0)):"blur"===n&&(t.removeEventListener("keyup",c),t.removeEventListener("focusout",v,!0)),t.className+=" polyfilled"),h(r,l)}}},f=function(i,n){if(-1!==o.indexOf(i.getAttribute("type"))&&null!==n){var l=i.getClientRects(),r=window.getComputedStyle(i),a=e.createElement("select");if(a.setAttribute("class","polyfilling"),a.style.position="absolute",h(!1,a),a.setAttribute("tabindex","-1"),a.setAttribute("aria-live","polite"),a.setAttribute("role","listbox"),t||a.setAttribute("aria-multiselectable","false"),"block"===r.getPropertyValue("display"))a.style.marginTop="-"+r.getPropertyValue("margin-bottom");else{var s="rtl"===r.getPropertyValue("direction")?"right":"left";a.style.setProperty("margin-"+s,"-"+(l[0].width+parseFloat(r.getPropertyValue("margin-"+s)))+"px"),a.style.marginTop=parseInt(l[0].height+(i.offsetTop-n.offsetTop),10)+"px"}if(a.style.borderRadius=r.getPropertyValue("border-radius"),a.style.minWidth=l[0].width+"px",t){var u=e.createElement("option");u.innerText=n.title,u.disabled=!0,u.setAttribute("class","message"),a.appendChild(u)}return n.appendChild(a),t?a.addEventListener("change",m):a.addEventListener("click",m),a.addEventListener("blur",m),a.addEventListener("keydown",m),a.addEventListener("keypress",g),a}},g=function(t){var i=t.target,n=i.parentNode,l=e.querySelector('input[list="'+n.id+'"]');"select"===i.tagName.toLowerCase()&&null!==l&&(!t.key||"Backspace"!==t.key&&1!==t.key.length||(l.focus(),"Backspace"===t.key?(l.value=l.value.substr(0,l.value.length-1),b(l)):l.value+=t.key,y(n,l)))},m=function(t){var i=t.currentTarget,n=i.parentNode,l=e.querySelector('input[list="'+n.id+'"]');if("select"===i.tagName.toLowerCase()&&null!==l){var r=t.type,a="keydown"===r&&13!==t.keyCode&&27!==t.keyCode;if(("change"===r||"click"===r||"keydown"===r&&(13===t.keyCode||"Tab"===t.key))&&i.value.length>0&&i.value!==n.title){var o;l.value="email"===l.getAttribute("type")&&null!==l.getAttribute("multiple")&&(o=l.value.lastIndexOf(","))>-1?l.value.slice(0,o)+","+i.value:l.value=i.value,b(l),"Tab"!==t.key&&l.focus(),a=!1}else"keydown"===r&&27===t.keyCode&&l.focus();h(a,i)}},b=function(t){var i;"function"==typeof Event?i=new Event("input",{bubbles:!0}):(i=e.createEvent("Event"),i.initEvent("input",!0,!1)),t.dispatchEvent(i)},h=function(t,i){t?i.removeAttribute("hidden"):i.setAttributeNode(e.createAttribute("hidden")),i.setAttribute("aria-hidden",(!t).toString())};e.addEventListener("focusin",v,!0)}();
{
"name": "datalist-polyfill",
"version": "1.21.0",
"version": "1.21.1",
"description":

@@ -5,0 +5,0 @@ "A minimal and dependency-free vanilla JavaScript datalist polyfill. Supports all standard's functionality as well as mimics other browsers behavior.",

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