Skip to content

Commit

Permalink
Fixed processing styles for non-HTML namespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekbogdanski committed Nov 8, 2021
1 parent 9e00921 commit 87913d2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion core/htmlparser/cdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,29 @@
*/
type: CKEDITOR.NODE_TEXT,

filter: function() {},
filter: function( filter ) {
var style = this.getAscendant( 'style' );

if ( !style ) {
return;
}

// MathML and SVG namespaces processing parsers `style` content as a normal HTML, not text.
// Make sure to filter such content also.
var nonHtmlElementNamespace = style.getAscendant( { math: 1, svg: 1 } );

if ( !nonHtmlElementNamespace ) {
return;
}

var fragment = CKEDITOR.htmlParser.fragment.fromHtml( this.value ),
writer = new CKEDITOR.htmlParser.basicWriter();

filter.applyTo( fragment );
fragment.writeHtml( writer );

this.value = writer.getHtml();
},

/**
* Writes the CDATA with no special manipulations.
Expand Down

0 comments on commit 87913d2

Please sign in to comment.