From d18678b1702f47319cbbf28547d71758f2cbe465 Mon Sep 17 00:00:00 2001 From: denis Date: Sat, 2 Mar 2019 13:57:54 +0100 Subject: [PATCH] Update to bootstrap 4.3 --- types/bootstrap/bootstrap-tests.ts | 73 ++++++++++++------------------ types/bootstrap/index.d.ts | 21 ++++++++- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/types/bootstrap/bootstrap-tests.ts b/types/bootstrap/bootstrap-tests.ts index 9344423cfb..01e5d5352f 100755 --- a/types/bootstrap/bootstrap-tests.ts +++ b/types/bootstrap/bootstrap-tests.ts @@ -196,6 +196,12 @@ $("#popover").popover({ offset: 10, fallbackPlacement: ["flip", "clockwise"], boundary: "scrollParent", + sanitize: false, + whiteList: { + h1: [], + img: ['src', 'alt', 'title', 'width', 'height'], + }, + sanitizeFn: (x: string) => x.replace("<", ""), }); $("#popover").popover({ @@ -207,6 +213,10 @@ $("#popover").popover({ }, }); +$("#popover").popover({ + sanitizeFn: null, +}); + // -------------------------------------------------------------------------------------- // Scrollspy // -------------------------------------------------------------------------------------- @@ -280,10 +290,23 @@ $("#tooltip").on("hide.bs.tooltip", () => {}); $("#tooltip").tooltip({ animation: false, -}); - -$("#tooltip").tooltip({ container: "#container", + delay: {show: 500, hide: 100}, + html: true, + placement: "auto", + selector: "[rel=\"tooltip\"]", + template: '', + title: "Hello world", + trigger: "hover focus", + offset: 10, + fallbackPlacement: ["flip", "clockwise"], + boundary: "scrollParent", + sanitize: false, + whiteList: { + h1: [], + img: ['src', 'alt', 'title', 'width', 'height'], + }, + sanitizeFn: (x: string) => x.replace("<", ""), }); $("#tooltip").tooltip({ @@ -298,18 +321,6 @@ $("#tooltip").tooltip({ delay: 250, }); -$("#tooltip").tooltip({ - delay: {show: 500, hide: 100}, -}); - -$("#tooltip").tooltip({ - html: true, -}); - -$("#tooltip").tooltip({ - placement: "auto", -}); - $("#tooltip").tooltip({ placement(this, tooltip, trigger) { console.log(this.tip === tooltip); @@ -327,22 +338,10 @@ $("#tooltip").tooltip({ }, }); -$("#tooltip").tooltip({ - selector: "[rel=\"tooltip\"]", -}); - $("#tooltip").tooltip({ selector: false, }); -$("#tooltip").tooltip({ - template: '', -}); - -$("#tooltip").tooltip({ - title: "Hello world", -}); - $("#tooltip").tooltip({ title: document.getElementById("title-element") as HTMLElement, }); @@ -353,14 +352,6 @@ $("#tooltip").tooltip({ }, }); -$("#tooltip").tooltip({ - trigger: "hover focus", -}); - -$("#tooltip").tooltip({ - offset: 10, -}); - $("#tooltip").tooltip({ offset: "10px", }); @@ -369,14 +360,10 @@ $("#tooltip").tooltip({ fallbackPlacement: "clockwise", }); -$("#tooltip").tooltip({ - fallbackPlacement: ["flip", "clockwise"], -}); - -$("#tooltip").tooltip({ - boundary: "scrollParent", -}); - $("#tooltip").tooltip({ boundary: aHtmlElement, }); + +$("#popover").popover({ + sanitizeFn: null, +}); diff --git a/types/bootstrap/index.d.ts b/types/bootstrap/index.d.ts index 2fb473fc29..6dc5f21a28 100755 --- a/types/bootstrap/index.d.ts +++ b/types/bootstrap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Bootstrap 4.2 +// Type definitions for Bootstrap 4.3 // Project: https://github.com/twbs/bootstrap/, https://getbootstrap.com // Definitions by: denisname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -352,6 +352,25 @@ export interface TooltipOption { * @default "scrollParent" */ boundary?: Popper.Boundary | HTMLElement; + + /** + * Enable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized. + * + * @default true + */ + sanitize?: boolean; + + /** + * Object which contains allowed attributes and tags. + */ + whiteList?: {[key: string]: string[]}; + + /** + * Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization. + * + * @default null + */ + sanitizeFn?: null | ((input: string) => string); } // --------------------------------------------------------------------------------------