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

encode/decode data-embed-code attribute #374

Merged
merged 1 commit into from
Aug 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@

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

data[key].value = $data.html();
Expand Down
2 changes: 1 addition & 1 deletion src/js/embeds.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@
// Store embed code with <script> tag inside wrapper attribute value.
// Make nice attribute value escaping using jQuery.
$div = $('<div>')
.attr('data-embed-code', html)
.attr('data-embed-code', $('<div />').text(html).html())
.html(html);
html = $('<div>').append($div).html();
}
Expand Down