mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 01:05:34 +03:00
Fix text nodes extraction fails on template element
This commit is contained in:
parent
4d03f8fba4
commit
82163c0b88
1 changed files with 9 additions and 3 deletions
|
@ -30,9 +30,15 @@ const TWITTER_MENTION_REGEX = /@[a-zA-Z0-9_]+@(twitter|x)\.com/;
|
||||||
const TWITTER_MENTION_CAPTURE_REGEX = /(@([a-zA-Z0-9_]+)@(twitter|x)\.com)/g;
|
const TWITTER_MENTION_CAPTURE_REGEX = /(@([a-zA-Z0-9_]+)@(twitter|x)\.com)/g;
|
||||||
|
|
||||||
function createDOM(html, isDocumentFragment) {
|
function createDOM(html, isDocumentFragment) {
|
||||||
const tpl = document.createElement('template');
|
if (isDocumentFragment) {
|
||||||
tpl.innerHTML = html;
|
const tpl = document.createElement('template');
|
||||||
return isDocumentFragment ? tpl.content : tpl;
|
tpl.innerHTML = html;
|
||||||
|
return tpl.content;
|
||||||
|
} else {
|
||||||
|
const tpl = document.createElement('div');
|
||||||
|
tpl.innerHTML = html;
|
||||||
|
return tpl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _enhanceContent(content, opts = {}) {
|
function _enhanceContent(content, opts = {}) {
|
||||||
|
|
Loading…
Reference in a new issue