From 3dc10d903e8d706290a6bf9a47f20991eed5edb0 Mon Sep 17 00:00:00 2001
From: Jakub Chalupa <chaluja7@fel.cvut.cz>
Date: Fri, 11 Mar 2016 18:26:40 +0100
Subject: [PATCH] #14451 - Widget crashes if editable region has a numeric ID
---
core/dom/element.js | 2 +-
tests/plugins/image2/image2.html | 10 ++++++++++
tests/plugins/image2/image2.js | 40 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/core/dom/element.js b/core/dom/element.js
index b586b02..4b58d1d 100644
a
|
b
|
CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatab |
2038 | 2038 | } |
2039 | 2039 | |
2040 | 2040 | function getContextualizedSelector( element, selector ) { |
2041 | | return '#' + element.$.id + ' ' + selector.split( /,\s*/ ).join( ', #' + element.$.id + ' ' ); |
| 2041 | return '#' + CSS.escape( element.$.id ) + ' ' + selector.split( /,\s*/ ).join( ', #' + CSS.escape( element.$.id ) + ' ' ); |
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | var sides = { |
diff --git a/tests/plugins/image2/image2.html b/tests/plugins/image2/image2.html
index 0748671..7e218e4 100644
a
|
b
|
|
99 | 99 | <figcaption>caption1</figcaption> |
100 | 100 | </figure> |
101 | 101 | </textarea> |
| 102 | |
| 103 | <!-- numeric widget ID --> |
| 104 | |
| 105 | <textarea id="editor_widget_numeric_id"> |
| 106 | <p>x</p> |
| 107 | <figure class="image"> |
| 108 | <img src="_assets/foo.png" alt="foo" /> |
| 109 | <figcaption id="100">caption1</figcaption> |
| 110 | </figure> |
| 111 | </textarea> |
102 | 112 | </body> |
| 113 | No newline at end of file |
diff --git a/tests/plugins/image2/image2.js b/tests/plugins/image2/image2.js
index dee11b8..83b29a8 100644
a
|
b
|
|
405 | 405 | '</figure>' |
406 | 406 | } ); |
407 | 407 | |
| 408 | // -- numeric widget ID ------------------------------------------------- |
| 409 | |
| 410 | tools.addTests( tcs, { |
| 411 | name: 'widget_numeric_id', |
| 412 | widgetName: 'image', |
| 413 | extraPlugins: 'image2', |
| 414 | extraAllowedContent: 'figcaption[id]', |
| 415 | editorConfig: alignClassesEditorConfig, |
| 416 | initialInstancesNumber: 1, |
| 417 | assertWidgets: function( editor ) { |
| 418 | var figcaption = editor.document.getById( '100' ); |
| 419 | assert.isNotUndefined( figcaption, 'Figcaption with id 100 should exists' ); |
| 420 | assert.isNotNull( figcaption, 'Figcaption with id 100 shoul be non null element' ); |
| 421 | |
| 422 | assertWidgetData( { |
| 423 | align: 'none', |
| 424 | src: '_assets/foo.png', |
| 425 | alt: 'foo', |
| 426 | width: '', |
| 427 | height: '', |
| 428 | hasCaption: true, |
| 429 | figcaption: figcaption |
| 430 | }, 'caption1' ); |
| 431 | }, |
| 432 | newData: newDialogData( { |
| 433 | align: 'none', |
| 434 | src: '_assets/bar.png', |
| 435 | alt: 'bar', |
| 436 | width: '200', |
| 437 | height: '250', |
| 438 | hasCaption: true |
| 439 | } ), |
| 440 | newWidgetPattern: |
| 441 | '<figure class="image">' + |
| 442 | '<img alt="bar" height="250" src="_assets/bar.png" width="200" />' + |
| 443 | '<figcaption>Caption</figcaption>' + |
| 444 | '</figure>' |
| 445 | |
| 446 | } ); |
| 447 | |
408 | 448 | bender.test( tcs ); |
409 | 449 | |
410 | 450 | function assertWidgetData( data, caption ) { |