@@ -1571,13 +1571,13 @@ function MusicKeyboard(activity) {
15711571 cell . style . left = "0px" ;
15721572 cell . className = "headcol" ; // This cell is fixed horizontally.
15731573 if ( this . displayLayout [ i ] . noteName === "drum" ) {
1574- cell . innerHTML = this . displayLayout [ i ] . voice ;
1574+ cell . textContent = this . displayLayout [ i ] . voice ;
15751575 } else if ( this . displayLayout [ i ] . noteName === "hertz" ) {
1576- cell . innerHTML = this . displayLayout [ i ] . noteOctave . toString ( ) + "HZ" ;
1576+ cell . textContent = this . displayLayout [ i ] . noteOctave . toString ( ) + "HZ" ;
15771577 } else {
1578- cell . innerHTML = `${ i18nSolfege (
1578+ cell . innerHTML = `${ escapeHTML ( i18nSolfege (
15791579 this . displayLayout [ i ] . noteName
1580- ) } <sub>${ this . displayLayout [ i ] . noteOctave . toString ( ) } </sub>`;
1580+ ) ) } <sub>${ escapeHTML ( this . displayLayout [ i ] . noteOctave . toString ( ) ) } </sub>`;
15811581 }
15821582
15831583 cell . setAttribute ( "id" , "labelcol" + ( n - i - 1 ) ) ;
@@ -1621,7 +1621,7 @@ function MusicKeyboard(activity) {
16211621 cell . style . minWidth = Math . floor ( MATRIXSOLFEWIDTH * this . _cellScale ) * 1.5 + "px" ;
16221622 cell . style . maxWidth = cell . style . minWidth ;
16231623 cell . className = "headcol" ; // This cell is fixed horizontally.
1624- cell . innerHTML = _ ( "Note value" ) ;
1624+ cell . textContent = _ ( "Note value" ) ;
16251625 cell . style . position = "sticky" ;
16261626 cell . style . left = "0px" ;
16271627 cell . style . zIndex = "1" ;
@@ -1673,7 +1673,7 @@ function MusicKeyboard(activity) {
16731673 cell . style . maxWidth = cell . style . width ;
16741674 cell . style . lineHeight = 60 + "%" ;
16751675 cell . style . textAlign = "center" ;
1676- cell . innerHTML = `${ dur [ 0 ] . toString ( ) } /${ dur [ 1 ] . toString ( ) } ` ;
1676+ cell . textContent = `${ dur [ 0 ] . toString ( ) } /${ dur [ 1 ] . toString ( ) } ` ;
16771677 cell . setAttribute ( "id" , "cells-" + j ) ;
16781678 cell . setAttribute ( "start" , selectedNotes [ j ] . startTime ) ;
16791679 cell . setAttribute ( "dur" , maxWidth ) ;
@@ -2531,7 +2531,7 @@ function MusicKeyboard(activity) {
25312531
25322532 const cell = docById ( "labelcol" + ( this . layout . length - index - 1 ) ) ;
25332533 this . layout [ index ] . noteOctave = parseInt ( blockValue ) ;
2534- cell . innerHTML = this . layout [ index ] . noteName + this . layout [ index ] . noteOctave . toString ( ) ;
2534+ cell . textContent = this . layout [ index ] . noteName + this . layout [ index ] . noteOctave . toString ( ) ;
25352535 this . _notesPlayed . map ( function ( item ) {
25362536 if ( item . objId == this . layout [ index ] . blockNumber ) {
25372537 item . noteOctave = parseInt ( blockValue ) ;
@@ -2592,7 +2592,7 @@ function MusicKeyboard(activity) {
25922592 const cell = docById ( "labelcol" + ( this . layout . length - index - 1 ) ) ;
25932593 this . layout [ index ] . noteName = label ;
25942594 this . layout [ index ] . noteOctave = octave ;
2595- cell . innerHTML = this . layout [ index ] . noteName + this . layout [ index ] . noteOctave . toString ( ) ;
2595+ cell . textContent = this . layout [ index ] . noteName + this . layout [ index ] . noteOctave . toString ( ) ;
25962596 const temp1 = label ;
25972597 let temp2 ;
25982598 if ( temp1 in FIXEDSOLFEGE1 ) {
@@ -2781,9 +2781,9 @@ function MusicKeyboard(activity) {
27812781 ] ) ;
27822782 newel . innerHTML = `${
27832783 myrowId < WHITEKEYS . length
2784- ? `<small>(${ String . fromCharCode ( WHITEKEYS [ myrowId ] ) } )</small><br/>`
2784+ ? `<small>(${ escapeHTML ( String . fromCharCode ( WHITEKEYS [ myrowId ] ) ) } )</small><br/>`
27852785 : ""
2786- } ${ this . displayLayout [ p ] . voice } `;
2786+ } ${ escapeHTML ( this . displayLayout [ p ] . voice ) } `;
27872787
27882788 this . displayLayout [ p ] . objId = "whiteRow" + myrowId . toString ( ) ;
27892789
@@ -2918,17 +2918,17 @@ function MusicKeyboard(activity) {
29182918 nname = this . displayLayout [ p ] . noteName . replace ( FLAT , "" ) . replace ( "b" , "" ) ;
29192919 if ( this . displayLayout [ p ] . blockNumber <= FAKEBLOCKNUMBER ) {
29202920 if ( SOLFEGENAMES . includes ( nname ) ) {
2921- newel2 . innerHTML = `<small>(${ String . fromCharCode (
2921+ newel2 . innerHTML = `<small>(${ escapeHTML ( String . fromCharCode (
29222922 BLACKKEYS [ myrow2Id ]
2923- ) } )</small><br/>${ i18nSolfege ( nname ) } ${ FLAT } ${
2923+ ) ) } )</small><br/>${ escapeHTML ( i18nSolfege ( nname ) ) } ${ FLAT } ${ escapeHTML (
29242924 this . displayLayout [ p ] . noteOctave
2925- } `;
2925+ ) } `;
29262926 } else {
2927- newel2 . innerHTML = `<small>(${ String . fromCharCode (
2927+ newel2 . innerHTML = `<small>(${ escapeHTML ( String . fromCharCode (
29282928 BLACKKEYS [ myrow2Id ]
2929- ) } )</small><br/>${ this . displayLayout [ p ] . noteName } ${
2929+ ) ) } )</small><br/>${ escapeHTML ( this . displayLayout [ p ] . noteName ) } ${ escapeHTML (
29302930 this . displayLayout [ p ] . noteOctave
2931- } `;
2931+ ) } `;
29322932 }
29332933 }
29342934 if ( p < this . layout . length ) {
@@ -2964,17 +2964,17 @@ function MusicKeyboard(activity) {
29642964 if ( SOLFEGENAMES . includes ( this . displayLayout [ p ] . noteName ) ) {
29652965 newel . innerHTML = `${
29662966 myrowId < WHITEKEYS . length
2967- ? `<small>(${ String . fromCharCode ( WHITEKEYS [ myrowId ] ) } )</small><br/>`
2967+ ? `<small>(${ escapeHTML ( String . fromCharCode ( WHITEKEYS [ myrowId ] ) ) } )</small><br/>`
29682968 : ""
2969- } ${ i18nSolfege ( this . displayLayout [ p ] . noteName ) } ${
2969+ } ${ escapeHTML ( i18nSolfege ( this . displayLayout [ p ] . noteName ) ) } ${ escapeHTML (
29702970 this . displayLayout [ p ] . noteOctave
2971- } `;
2971+ ) } `;
29722972 } else {
29732973 newel . innerHTML = `${
29742974 myrowId < WHITEKEYS . length
2975- ? `<small>(${ String . fromCharCode ( WHITEKEYS [ myrowId ] ) } )</small><br/>`
2975+ ? `<small>(${ escapeHTML ( String . fromCharCode ( WHITEKEYS [ myrowId ] ) ) } )</small><br/>`
29762976 : ""
2977- } ${ this . displayLayout [ p ] . noteName } ${ this . displayLayout [ p ] . noteOctave } `;
2977+ } ${ escapeHTML ( this . displayLayout [ p ] . noteName ) } ${ escapeHTML ( this . displayLayout [ p ] . noteOctave ) } `;
29782978 }
29792979 }
29802980 if ( p < this . layout . length ) {
0 commit comments