Skip to content

Commit

Permalink
Merge branch 't/13292'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed May 29, 2015
2 parents 55a9c5b + 6d085c6 commit a2ff7bf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -9,6 +9,7 @@ Fixed Issues:
* [#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)!
* [#13268](http://dev.ckeditor.com/ticket/13268): Fixed: Documentation for `CKEDITOR.dom.text` is incorrect. Thanks to [Ben Kiefer](https://github.com/benkiefer)!
* [#12739](http://dev.ckeditor.com/ticket/12739): Fixed: Link loses inline styles when edited without dialogadvtab. Thanks to [Віталій Крутько](https://github.com/asmforce)!
* [#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)!
* [#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.
* [#13233](http://dev.ckeditor.com/ticket/13233): Fixed: HTMLDataProcessor can process `foo:href` attributes.
* [#12796](http://dev.ckeditor.com/ticket/12796): Fixed: The [Indent List](http://ckeditor.com/addon/indentlist) plugin unwraps parent `<li>` elements.
Expand Down
2 changes: 1 addition & 1 deletion core/htmldataprocessor.js
Expand Up @@ -907,7 +907,7 @@
// Different protection pattern is used for those that
// live in attributes to avoid from being HTML encoded.
// Why so serious? See #9205, #8216, #7805, #11754, #11846.
data = data.replace( /<\w+(?:\s+(?:(?:[^\s=>]+\s*=\s*(?:[^'"\s>]+|'[^']*'|"[^"]*"))|[^\s=>]+))+\s*>/g, function( match ) {
data = data.replace( /<\w+(?:\s+(?:(?:[^\s=>]+\s*=\s*(?:[^'"\s>]+|'[^']*'|"[^"]*"))|[^\s=\/>]+))+\s*\/?>/g, function( match ) {
return match.replace( /<!--\{cke_protected\}([^>]*)-->/g, function( match, data ) {
store[ store.id ] = decodeURIComponent( data );
return '{cke_protected_' + ( store.id++ ) + '}';
Expand Down
34 changes: 34 additions & 0 deletions tests/core/htmldataprocessor.js
Expand Up @@ -562,6 +562,40 @@
}
},

// #13292
'test protected source in attribute in self-closing tag': function() {
var processor = this.editor3.dataProcessor,
source = '<p><img src="[[image]]"/></a></p>',
expectedHtml = '<p><img data-cke-saved-src="{cke_protected_1}" src="{cke_protected_1}" /></p>',
expectedOutput = '<p><img src="[[image]]" /></p>';

var html = processor.toHtml( source );

assert.isInnerHtmlMatching( expectedHtml, html, 'toHtml' );

assert.areSame( expectedOutput, processor.toDataFormat( html ), 'toDataFormat' );
},

// #11754
'test malformed HTML does not hang the processor': function() {
var processor = this.editor.dataProcessor,
source = '<table border=0 cellspacing=0 cellpadding=0 style=\'border-collapse:collapse;></table>',
expectedHtml = '@';

assert.isInnerHtmlMatching( expectedHtml, processor.toHtml( source ) );
},

// #11846
'test malformed HTML does not hang the processor 2': function() {
var processor = this.editor.dataProcessor,
source =
'<span id="sample" overflow="hidden" ;"="" style="font-size:8pt; font-weight:normal; ' +
'font-style:normal; color:#808080; background:transparent">Text</span>';

processor.toHtml( source );
assert.isTrue( true, 'happy to be here' );
},

// Some elements should not have protected source markup inside. (#11223)
'test protected source in title': addProtectedSourceTC( '<p>[[mytag]]</p>', '[[mytag]]' ),
'test protected source in iframe': addProtectedSourceTC( '<p><iframe name="aa">[[mytag]]</iframe></p>' ),
Expand Down

0 comments on commit a2ff7bf

Please sign in to comment.