File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,17 @@ export class DomUtils {
199199 return sanitizedHtml ;
200200 }
201201
202+ /**
203+ * Many extensions inject their own stylings into the page, and generally that isn't a problem. But,
204+ * occasionally the styling includes a specific font, which can be very, very large. This method
205+ * removes any base64 encoded binaries defined in any <style> tags.
206+ */
207+ public static removeStylesWithBase64EncodedBinaries ( doc : Document ) : void {
208+ DomUtils . domReplacer ( doc , "style" , ( node : HTMLElement ) => {
209+ return node . innerHTML . indexOf ( "data:application" ) !== - 1 ? undefined : node ;
210+ } ) ;
211+ }
212+
202213 public static removeElementsNotSupportedInOnml ( doc : Document ) : void {
203214 // For elements that cannot be converted into something equivalent in ONML, we remove them ...
204215 DomUtils . domReplacer ( doc , DomUtils . tagsNotSupportedInOnml . join ( ) ) ;
@@ -336,6 +347,7 @@ export class DomUtils {
336347 }
337348
338349 public static removeUnwantedItems ( doc : Document ) : void {
350+ DomUtils . removeStylesWithBase64EncodedBinaries ( doc ) ;
339351 DomUtils . removeClipperElements ( doc ) ;
340352 DomUtils . removeUnwantedElements ( doc ) ;
341353 DomUtils . removeUnwantedAttributes ( doc ) ;
You can’t perform that action at this time.
0 commit comments