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 {
199
199
return sanitizedHtml ;
200
200
}
201
201
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
+
202
213
public static removeElementsNotSupportedInOnml ( doc : Document ) : void {
203
214
// For elements that cannot be converted into something equivalent in ONML, we remove them ...
204
215
DomUtils . domReplacer ( doc , DomUtils . tagsNotSupportedInOnml . join ( ) ) ;
@@ -336,6 +347,7 @@ export class DomUtils {
336
347
}
337
348
338
349
public static removeUnwantedItems ( doc : Document ) : void {
350
+ DomUtils . removeStylesWithBase64EncodedBinaries ( doc ) ;
339
351
DomUtils . removeClipperElements ( doc ) ;
340
352
DomUtils . removeUnwantedElements ( doc ) ;
341
353
DomUtils . removeUnwantedAttributes ( doc ) ;
You can’t perform that action at this time.
0 commit comments