Skip to content

Commit a2ff7bf

Browse files
committed
Merge branch 't/13292'
2 parents 55a9c5b + 6d085c6 commit a2ff7bf

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Fixed Issues:
99
* [#13254](http://dev.ckeditor.com/ticket/13254): Fixed: Cannot outdent block after indent when using [Divarea](http://ckeditor.com/addon/divarea) plugin. Thanks to [Jonathan Cottrill](https://github.com/jcttrll)!
1010
* [#13268](http://dev.ckeditor.com/ticket/13268): Fixed: Documentation for `CKEDITOR.dom.text` is incorrect. Thanks to [Ben Kiefer](https://github.com/benkiefer)!
1111
* [#12739](http://dev.ckeditor.com/ticket/12739): Fixed: Link loses inline styles when edited without dialogadvtab. Thanks to [Віталій Крутько](https://github.com/asmforce)!
12+
* [#13292](http://dev.ckeditor.com/ticket/13292): Fixed: Protection pattern does not work in attribute in self-closing elements with no space before `/>`. Thanks to [Віталій Крутько](https://github.com/asmforce)!
1213
* [#13232](http://dev.ckeditor.com/ticket/13232): [Safari] Fixed: Method [`element.appendText()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-appendText) work properly for empty elements.
1314
* [#13233](http://dev.ckeditor.com/ticket/13233): Fixed: HTMLDataProcessor can process `foo:href` attributes.
1415
* [#12796](http://dev.ckeditor.com/ticket/12796): Fixed: The [Indent List](http://ckeditor.com/addon/indentlist) plugin unwraps parent `<li>` elements.

core/htmldataprocessor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@
907907
// Different protection pattern is used for those that
908908
// live in attributes to avoid from being HTML encoded.
909909
// Why so serious? See #9205, #8216, #7805, #11754, #11846.
910-
data = data.replace( /<\w+(?:\s+(?:(?:[^\s=>]+\s*=\s*(?:[^'"\s>]+|'[^']*'|"[^"]*"))|[^\s=>]+))+\s*>/g, function( match ) {
910+
data = data.replace( /<\w+(?:\s+(?:(?:[^\s=>]+\s*=\s*(?:[^'"\s>]+|'[^']*'|"[^"]*"))|[^\s=\/>]+))+\s*\/?>/g, function( match ) {
911911
return match.replace( /<!--\{cke_protected\}([^>]*)-->/g, function( match, data ) {
912912
store[ store.id ] = decodeURIComponent( data );
913913
return '{cke_protected_' + ( store.id++ ) + '}';

tests/core/htmldataprocessor.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,40 @@
562562
}
563563
},
564564

565+
// #13292
566+
'test protected source in attribute in self-closing tag': function() {
567+
var processor = this.editor3.dataProcessor,
568+
source = '<p><img src="[[image]]"/></a></p>',
569+
expectedHtml = '<p><img data-cke-saved-src="{cke_protected_1}" src="{cke_protected_1}" /></p>',
570+
expectedOutput = '<p><img src="[[image]]" /></p>';
571+
572+
var html = processor.toHtml( source );
573+
574+
assert.isInnerHtmlMatching( expectedHtml, html, 'toHtml' );
575+
576+
assert.areSame( expectedOutput, processor.toDataFormat( html ), 'toDataFormat' );
577+
},
578+
579+
// #11754
580+
'test malformed HTML does not hang the processor': function() {
581+
var processor = this.editor.dataProcessor,
582+
source = '<table border=0 cellspacing=0 cellpadding=0 style=\'border-collapse:collapse;></table>',
583+
expectedHtml = '@';
584+
585+
assert.isInnerHtmlMatching( expectedHtml, processor.toHtml( source ) );
586+
},
587+
588+
// #11846
589+
'test malformed HTML does not hang the processor 2': function() {
590+
var processor = this.editor.dataProcessor,
591+
source =
592+
'<span id="sample" overflow="hidden" ;"="" style="font-size:8pt; font-weight:normal; ' +
593+
'font-style:normal; color:#808080; background:transparent">Text</span>';
594+
595+
processor.toHtml( source );
596+
assert.isTrue( true, 'happy to be here' );
597+
},
598+
565599
// Some elements should not have protected source markup inside. (#11223)
566600
'test protected source in title': addProtectedSourceTC( '<p>[[mytag]]</p>', '[[mytag]]' ),
567601
'test protected source in iframe': addProtectedSourceTC( '<p><iframe name="aa">[[mytag]]</iframe></p>' ),

0 commit comments

Comments
 (0)