Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 051f4ee

Browse files
authored
encode/decode data-embed-code attribute (#374)
1 parent f0c35f3 commit 051f4ee

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/js/core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@
146146

147147
// Restore original embed code from embed wrapper attribute value.
148148
$data.find('[data-embed-code]').each(function () {
149-
var $this = $(this);
150-
$this.html($this.attr('data-embed-code'));
149+
var $this = $(this),
150+
html = $('<div />').html($this.attr('data-embed-code')).text();
151+
$this.html(html);
151152
});
152153

153154
data[key].value = $data.html();

src/js/embeds.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429
// Store embed code with <script> tag inside wrapper attribute value.
430430
// Make nice attribute value escaping using jQuery.
431431
$div = $('<div>')
432-
.attr('data-embed-code', html)
432+
.attr('data-embed-code', $('<div />').text(html).html())
433433
.html(html);
434434
html = $('<div>').append($div).html();
435435
}

0 commit comments

Comments
 (0)