mirror of
https://github.com/Choices-js/Choices.git
synced 2026-03-14 14:45:47 +01:00
allowHtml now defaults to false
This commit is contained in:
parent
77f362eb42
commit
0195386f2f
16 changed files with 17 additions and 96 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* `allowHtml` now defaults to false.
|
||||
* HTML escaping of choice/item labels should no longer double escape depending on allowHTML mode.
|
||||
* Templates/text functions now escape `'` characters for display.
|
||||
* `addItemText`/`uniqueItemText`/`customAddItemText` are now called with the `value` argument already escaped.
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ Or include Choices directly:
|
|||
removeItemButton: false,
|
||||
removeItemButtonAlignLeft: false,
|
||||
editItems: false,
|
||||
allowHTML: true,
|
||||
allowHTML: false,
|
||||
duplicateItemsAllowed: true,
|
||||
delimiter: ',',
|
||||
paste: true,
|
||||
|
|
@ -359,14 +359,12 @@ Pass an array of objects:
|
|||
|
||||
### allowHTML
|
||||
|
||||
**Type:** `Boolean` **Default:** `true`
|
||||
**Type:** `Boolean` **Default:** `false`
|
||||
|
||||
**Input types affected:** `text`, `select-one`, `select-multiple`
|
||||
|
||||
**Usage:** Whether HTML should be rendered in all Choices elements. If `false`, all elements (placeholder, items, etc.) will be treated as plain text. If `true`, this can be used to perform XSS scripting attacks if you load choices from a remote source.
|
||||
|
||||
**Deprecation Warning:** This will default to `false` in a future release.
|
||||
|
||||
### allowHtmlUserInput
|
||||
|
||||
**Type:** `Boolean` **Default:** `false`
|
||||
|
|
|
|||
|
|
@ -949,34 +949,6 @@ describe('Choices - select multiple', () => {
|
|||
});
|
||||
|
||||
describe('allow html', () => {
|
||||
describe('is undefined', () => {
|
||||
it('logs a deprecation warning', () => {
|
||||
cy.get('@consoleWarn').should(
|
||||
'be.calledOnceWithExactly',
|
||||
'Deprecation warning: allowHTML will default to false in a future release. To render HTML in Choices, you will need to set it to true. Setting allowHTML will suppress this message.',
|
||||
);
|
||||
});
|
||||
|
||||
it('does not show as text when selected', () => {
|
||||
cy.get('[data-test-hook=allowhtml-undefined]')
|
||||
.find('.choices__list--multiple .choices__item')
|
||||
.first()
|
||||
.should(($choice) => {
|
||||
expect($choice.text().trim()).to.equal('Choice 1');
|
||||
});
|
||||
});
|
||||
|
||||
it('does not show html as text in dropdown', () => {
|
||||
cy.get('[data-test-hook=allowhtml-undefined]')
|
||||
.find('.choices__list--dropdown .choices__list')
|
||||
.children()
|
||||
.first()
|
||||
.should(($choice) => {
|
||||
expect($choice.text().trim()).to.equal('Choice 2');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('set to true', () => {
|
||||
it('does not show as text when selected', () => {
|
||||
cy.get('[data-test-hook=allowhtml-true]')
|
||||
|
|
|
|||
|
|
@ -1070,25 +1070,6 @@ describe('Choices - select one', () => {
|
|||
});
|
||||
|
||||
describe('allow html', () => {
|
||||
describe('is undefined', () => {
|
||||
it('logs a deprecation warning', () => {
|
||||
cy.get('@consoleWarn').should(
|
||||
'be.calledOnceWithExactly',
|
||||
'Deprecation warning: allowHTML will default to false in a future release. To render HTML in Choices, you will need to set it to true. Setting allowHTML will suppress this message.',
|
||||
);
|
||||
});
|
||||
|
||||
it('does not show html as text', () => {
|
||||
cy.get('[data-test-hook=allowhtml-undefined]')
|
||||
.find('.choices__list--dropdown .choices__list')
|
||||
.children()
|
||||
.first()
|
||||
.should(($choice) => {
|
||||
expect($choice.text().trim()).to.equal('Choice 1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('set to true', () => {
|
||||
it('does not show html as text', () => {
|
||||
cy.get('[data-test-hook=allowhtml-true]')
|
||||
|
|
|
|||
|
|
@ -360,24 +360,6 @@ describe('Choices - text element', () => {
|
|||
});
|
||||
|
||||
describe('allow html', () => {
|
||||
describe('is undefined', () => {
|
||||
it('logs a deprecation warning', () => {
|
||||
cy.get('@consoleWarn').should(
|
||||
'be.calledOnceWithExactly',
|
||||
'Deprecation warning: allowHTML will default to false in a future release. To render HTML in Choices, you will need to set it to true. Setting allowHTML will suppress this message.',
|
||||
);
|
||||
});
|
||||
|
||||
it('does not show html as text', () => {
|
||||
cy.get('[data-test-hook=allowhtml-undefined]')
|
||||
.find('.choices__list--multiple .choices__item')
|
||||
.first()
|
||||
.should(($choice) => {
|
||||
expect($choice.text().trim()).to.equal('Mason Rogers');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('set to true', () => {
|
||||
it('does not show html as text', () => {
|
||||
cy.get('[data-test-hook=allowhtml-true]')
|
||||
|
|
|
|||
|
|
@ -230,9 +230,6 @@ var Choices = /** @class */function () {
|
|||
var _this = this;
|
||||
this._lastAddedChoiceId = 0;
|
||||
this._lastAddedGroupId = 0;
|
||||
if (userConfig.allowHTML === undefined) {
|
||||
console.warn('Deprecation warning: allowHTML will default to false in a future release. To render HTML in Choices, you will need to set it to true. Setting allowHTML will suppress this message.');
|
||||
}
|
||||
this.config = (0, utils_1.extend)(true, {}, defaults_1.DEFAULT_CONFIG, Choices.defaults.options, userConfig);
|
||||
var invalidConfigOptions = (0, utils_1.diff)(this.config, defaults_1.DEFAULT_CONFIG);
|
||||
if (invalidConfigOptions.length) {
|
||||
|
|
@ -240,10 +237,10 @@ var Choices = /** @class */function () {
|
|||
}
|
||||
if (!this.config.silent && this.config.allowHTML && this.config.allowHtmlUserInput) {
|
||||
if (this.config.addItems) {
|
||||
console.warn('Deprecation warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks');
|
||||
console.warn('Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks');
|
||||
}
|
||||
if (this.config.addChoices) {
|
||||
console.warn('Deprecation warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks');
|
||||
console.warn('Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks');
|
||||
}
|
||||
}
|
||||
var passedElement = typeof element === 'string' ? document.querySelector(element) : element;
|
||||
|
|
@ -2958,7 +2955,7 @@ exports.DEFAULT_CONFIG = {
|
|||
removeItemButton: false,
|
||||
removeItemButtonAlignLeft: false,
|
||||
editItems: false,
|
||||
allowHTML: true,
|
||||
allowHTML: false,
|
||||
allowHtmlUserInput: false,
|
||||
duplicateItemsAllowed: true,
|
||||
delimiter: ',',
|
||||
|
|
|
|||
2
public/assets/scripts/choices.min.js
vendored
2
public/assets/scripts/choices.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -386,7 +386,7 @@
|
|||
</div>
|
||||
|
||||
<div data-test-hook="allowhtml-undefined">
|
||||
<label for="choices-allowhtml-undefined">HTML allowed by default</label>
|
||||
<label for="choices-allowhtml-undefined">HTML disabled by default</label>
|
||||
<select
|
||||
class="form-control"
|
||||
name="choices-allowhtml-undefined"
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@
|
|||
</div>
|
||||
|
||||
<div data-test-hook="allowhtml-undefined">
|
||||
<label for="choices-allowhtml-undefined">HTML allowed by default</label>
|
||||
<label for="choices-allowhtml-undefined">HTML disabled by default</label>
|
||||
<select
|
||||
class="form-control"
|
||||
name="choices-allowhtml-undefined"
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
</div>
|
||||
|
||||
<div data-test-hook="allowhtml-undefined">
|
||||
<label for="allowhtml-undefined">HTML allowed by default</label>
|
||||
<label for="allowhtml-undefined">HTML disabled by default</label>
|
||||
<input class="form-control" id="allowhtml-undefined" type="text" />
|
||||
</div>
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -230,11 +230,9 @@ export interface Options {
|
|||
* If `false`, all elements (placeholder, items, etc.) will be treated as plain text.
|
||||
* If `true`, this can be used to perform XSS scripting attacks if you load choices from a remote source.
|
||||
*
|
||||
* **Deprecation Warning:** This will default to `false` in a future release.
|
||||
*
|
||||
* **Input types affected:** text, select-one, select-multiple
|
||||
*
|
||||
* @default true
|
||||
* @default false
|
||||
*/
|
||||
allowHTML: boolean;
|
||||
/**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mB,KACzC,IAAI,CAAC,GACV,IAAI,CAAC;IAET,mBAAmB,EAAE,KAAK,CAAC;CAC5B"}
|
||||
|
|
@ -161,12 +161,6 @@ class Choices implements ChoicesInterface {
|
|||
| HTMLSelectElement = '[data-choice]',
|
||||
userConfig: Partial<Options> = {},
|
||||
) {
|
||||
if (userConfig.allowHTML === undefined) {
|
||||
console.warn(
|
||||
'Deprecation warning: allowHTML will default to false in a future release. To render HTML in Choices, you will need to set it to true. Setting allowHTML will suppress this message.',
|
||||
);
|
||||
}
|
||||
|
||||
this.config = extend(
|
||||
true,
|
||||
{},
|
||||
|
|
@ -190,12 +184,12 @@ class Choices implements ChoicesInterface {
|
|||
) {
|
||||
if (this.config.addItems) {
|
||||
console.warn(
|
||||
'Deprecation warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks',
|
||||
'Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks',
|
||||
);
|
||||
}
|
||||
if (this.config.addChoices) {
|
||||
console.warn(
|
||||
'Deprecation warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks',
|
||||
'Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export const DEFAULT_CONFIG: Options = {
|
|||
removeItemButton: false,
|
||||
removeItemButtonAlignLeft: false,
|
||||
editItems: false,
|
||||
allowHTML: true,
|
||||
allowHTML: false,
|
||||
allowHtmlUserInput: false,
|
||||
duplicateItemsAllowed: true,
|
||||
delimiter: ',',
|
||||
|
|
|
|||
|
|
@ -245,11 +245,9 @@ export interface Options {
|
|||
* If `false`, all elements (placeholder, items, etc.) will be treated as plain text.
|
||||
* If `true`, this can be used to perform XSS scripting attacks if you load choices from a remote source.
|
||||
*
|
||||
* **Deprecation Warning:** This will default to `false` in a future release.
|
||||
*
|
||||
* **Input types affected:** text, select-one, select-multiple
|
||||
*
|
||||
* @default true
|
||||
* @default false
|
||||
*/
|
||||
allowHTML: boolean;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue