@@ -51,10 +51,10 @@ function Highlighter(options = hhDefaultOptions) {
5151
5252 // Set up stylesheets
5353 this . stylesheets = { }
54- generalStylesheet = createStylesheet ( this . stylesheets , 'general' ) ;
55- appearanceStylesheet = createStylesheet ( this . stylesheets , 'appearance' ) ;
56- highlightApiStylesheet = createStylesheet ( this . stylesheets , 'highlight-api' ) ;
57- selectionStylesheet = createStylesheet ( this . stylesheets , 'selection' ) ;
54+ generalStylesheet = addStylesheet ( this . stylesheets , 'general' ) ;
55+ appearanceStylesheet = addStylesheet ( this . stylesheets , 'appearance' ) ;
56+ highlightApiStylesheet = addStylesheet ( this . stylesheets , 'highlight-api' ) ;
57+ selectionStylesheet = addStylesheet ( this . stylesheets , 'selection' ) ;
5858 generalStylesheet . replaceSync ( `
5959 ${ options . containerSelector } {
6060 -webkit-tap-highlight-color: transparent;
@@ -1048,8 +1048,8 @@ function Highlighter(options = hhDefaultOptions) {
10481048 return styleTemplate ;
10491049 }
10501050
1051- // Create a CSS stylesheet
1052- function createStylesheet ( stylesheets , stylesheetKey ) {
1051+ // Add a CSS stylesheet to the document
1052+ function addStylesheet ( stylesheets , stylesheetKey ) {
10531053 let stylesheet = stylesheets [ stylesheetKey ] ;
10541054 if ( ! stylesheet ) {
10551055 if ( supportsCssStylesheetApi ) {
@@ -1073,7 +1073,7 @@ function Highlighter(options = hhDefaultOptions) {
10731073 return stylesheet ;
10741074 }
10751075
1076- // Remove CSS stylesheets
1076+ // Remove CSS stylesheets (only those from the current Highlighter instance)
10771077 function removeStylesheets ( stylesheets ) {
10781078 for ( const stylesheet of Object . values ( stylesheets ) ) {
10791079 if ( supportsCssStylesheetApi ) {
0 commit comments