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) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
@ -149,11 +149,14 @@ return /******/ (function(modules) { // webpackBootstrap
noChoicesText: 'No choices to choose from',
itemSelectText: 'Press to select',
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) {
return 'Only ' + maxItemCount + ' values can be added.';
},
itemComparer: function itemComparer(choice, item) {
return choice === item;
},
uniqueItemText: 'Only unique values can be added.',
classNames: {
containerOuter: 'choices',
@ -1067,7 +1070,7 @@ return /******/ (function(modules) { // webpackBootstrap
choiceValue.forEach(function (val) {
var foundChoice = choices.find(function (choice) {
// Check 'value' property exists and the choice isn't already selected
return choice.value === val;
return _this11.config.itemComparer(choice.value, val);
});
if (foundChoice) {
@ -5910,14 +5913,12 @@ return /******/ (function(modules) { // webpackBootstrap
};
/**
* Remove html tags from a string
* @param {String} Initial string/html
* Escape html in a string
* @param {String} html Initial string/html
* @return {String} Sanitised string
*/
var stripHTML = exports.stripHTML = function stripHTML(html) {
var el = document.createElement("DIV");
el.innerHTML = html;
return el.textContent || el.innerText || "";
return html.replace(/&/g, '&amp;').replace(/>/g, '&rt;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
};
/**
@ -5978,7 +5979,7 @@ return /******/ (function(modules) { // webpackBootstrap
var width = input.offsetWidth;
if (value) {
var testEl = strToEl('<span>' + value + '</span>');
var testEl = strToEl('<span>' + stripHTML(value) + '</span>');
testEl.style.position = 'absolute';
testEl.style.padding = '0';
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",
"version": "3.0.3",
"version": "3.0.4",
"description": "A vanilla JS customisable text input/select box plugin",
"main": [
"./assets/scripts/dist/choices.js",

View file

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

View file

@ -1,6 +1,6 @@
{
"name": "choices.js",
"version": "3.0.3",
"version": "3.0.4",
"description": "A vanilla JS customisable text input/select box plugin",
"main": "./assets/scripts/dist/choices.min.js",
"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 path = require('path');