Version 3.0.4

This commit is contained in:
Josh Johnson 2018-03-27 11:27:20 +01:00
parent 394bde313d
commit 9b860da254
7 changed files with 21 additions and 20 deletions

View file

@ -1,4 +1,4 @@
/*! choices.js v3.0.3 | (c) 2018 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ /*! choices.js v3.0.4 | (c) 2018 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(); module.exports = factory();
@ -149,11 +149,14 @@ return /******/ (function(modules) { // webpackBootstrap
noChoicesText: 'No choices to choose from', noChoicesText: 'No choices to choose from',
itemSelectText: 'Press to select', itemSelectText: 'Press to select',
addItemText: function addItemText(value) { addItemText: function addItemText(value) {
return 'Press Enter to add <b>"' + value + '"</b>'; return 'Press Enter to add <b>"' + (0, _utils.stripHTML)(value) + '"</b>';
}, },
maxItemText: function maxItemText(maxItemCount) { maxItemText: function maxItemText(maxItemCount) {
return 'Only ' + maxItemCount + ' values can be added.'; return 'Only ' + maxItemCount + ' values can be added.';
}, },
itemComparer: function itemComparer(choice, item) {
return choice === item;
},
uniqueItemText: 'Only unique values can be added.', uniqueItemText: 'Only unique values can be added.',
classNames: { classNames: {
containerOuter: 'choices', containerOuter: 'choices',
@ -1067,7 +1070,7 @@ return /******/ (function(modules) { // webpackBootstrap
choiceValue.forEach(function (val) { choiceValue.forEach(function (val) {
var foundChoice = choices.find(function (choice) { var foundChoice = choices.find(function (choice) {
// Check 'value' property exists and the choice isn't already selected // Check 'value' property exists and the choice isn't already selected
return choice.value === val; return _this11.config.itemComparer(choice.value, val);
}); });
if (foundChoice) { if (foundChoice) {
@ -5910,14 +5913,12 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
/** /**
* Remove html tags from a string * Escape html in a string
* @param {String} Initial string/html * @param {String} html Initial string/html
* @return {String} Sanitised string * @return {String} Sanitised string
*/ */
var stripHTML = exports.stripHTML = function stripHTML(html) { var stripHTML = exports.stripHTML = function stripHTML(html) {
var el = document.createElement("DIV"); return html.replace(/&/g, '&amp;').replace(/>/g, '&rt;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
el.innerHTML = html;
return el.textContent || el.innerText || "";
}; };
/** /**
@ -5978,7 +5979,7 @@ return /******/ (function(modules) { // webpackBootstrap
var width = input.offsetWidth; var width = input.offsetWidth;
if (value) { if (value) {
var testEl = strToEl('<span>' + value + '</span>'); var testEl = strToEl('<span>' + stripHTML(value) + '</span>');
testEl.style.position = 'absolute'; testEl.style.position = 'absolute';
testEl.style.padding = '0'; testEl.style.padding = '0';
testEl.style.top = '-9999px'; testEl.style.top = '-9999px';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{ {
"name": "choices.js", "name": "choices.js",
"version": "3.0.3", "version": "3.0.4",
"description": "A vanilla JS customisable text input/select box plugin", "description": "A vanilla JS customisable text input/select box plugin",
"main": [ "main": [
"./assets/scripts/dist/choices.js", "./assets/scripts/dist/choices.js",

View file

@ -16,7 +16,7 @@
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<!-- Ignore these --> <!-- Ignore these -->
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=3.0.3"> <link rel="stylesheet" href="assets/styles/css/base.min.css?version=3.0.4">
<!-- End ignore these --> <!-- End ignore these -->
<!-- Optional includes --> <!-- Optional includes -->
@ -24,8 +24,8 @@
<!-- End optional includes --> <!-- End optional includes -->
<!-- Choices includes --> <!-- Choices includes -->
<link rel="stylesheet" href="assets/styles/css/choices.min.css?version=3.0.3"> <link rel="stylesheet" href="assets/styles/css/choices.min.css?version=3.0.4">
<script src="assets/scripts/dist/choices.min.js?version=3.0.3"></script> <script src="assets/scripts/dist/choices.min.js?version=3.0.4"></script>
<!-- End Choices includes --> <!-- End Choices includes -->
<!--[if lt IE 9]> <!--[if lt IE 9]>

View file

@ -1,6 +1,6 @@
{ {
"name": "choices.js", "name": "choices.js",
"version": "3.0.3", "version": "3.0.4",
"description": "A vanilla JS customisable text input/select box plugin", "description": "A vanilla JS customisable text input/select box plugin",
"main": "./assets/scripts/dist/choices.min.js", "main": "./assets/scripts/dist/choices.min.js",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",

View file

@ -1,4 +1,4 @@
// Example usage: npm --newVersion=3.0.3 run version // Example usage: npm --newVersion=3.0.4 run version
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');