File tree Expand file tree Collapse file tree 3 files changed +2
-24
lines changed Expand file tree Collapse file tree 3 files changed +2
-24
lines changed Original file line number Diff line number Diff line change 2828 "base64-loader" : " 1.0.0" ,
2929 "css-tree" : " 1.1.3" ,
3030 "dompurify" : " ^2.5.6" ,
31- "fastestsmallesttextencoderdecoder" : " ^1.0.22" ,
3231 "transformation-matrix" : " 1.15.0"
3332 },
3433 "devDependencies" : {
Original file line number Diff line number Diff line change @@ -54,29 +54,14 @@ if (DOMPurify.isSupported) {
5454 ) ;
5555}
5656
57- // Use JS implemented TextDecoder and TextEncoder if it is not provided by the
58- // browser.
59- let _TextDecoder ;
60- let _TextEncoder ;
61- if ( typeof TextDecoder === 'undefined' || typeof TextEncoder === 'undefined' ) {
62- // Wait to require the text encoding polyfill until we know it's needed.
63- // eslint-disable-next-line global-require
64- const encoding = require ( 'fastestsmallesttextencoderdecoder' ) ;
65- _TextDecoder = encoding . TextDecoder ;
66- _TextEncoder = encoding . TextEncoder ;
67- } else {
68- _TextDecoder = TextDecoder ;
69- _TextEncoder = TextEncoder ;
70- }
71-
7257/**
7358 * Load an SVG Uint8Array of bytes and "sanitize" it
7459 * @param {!Uint8Array } rawData unsanitized SVG daata
7560 * @return {Uint8Array } sanitized SVG data
7661 */
7762sanitizeSvg . sanitizeByteStream = function ( rawData ) {
78- const decoder = new _TextDecoder ( ) ;
79- const encoder = new _TextEncoder ( ) ;
63+ const decoder = new TextDecoder ( ) ;
64+ const encoder = new TextEncoder ( ) ;
8065 const sanitizedText = sanitizeSvg . sanitizeSvgText ( decoder . decode ( rawData ) ) ;
8166 return encoder . encode ( sanitizedText ) ;
8267} ;
You can’t perform that action at this time.
0 commit comments