Jxck / html2json

html2json & json2html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to parse seperator <hr />

wongmunchoong opened this issue · comments

I used the html2json to parse my tinymce content to json format. so far all working until i put in
<hr />
i got this error

Uncaught (in promise) TypeError: Cannot read property 'child' of undefined
    at Object.HTMLParser.start (http://localhost:3000/html2json.js:69:21)
    at parseStartTag (https://cdn.rawgit.com/blowsie/Pure-JavaScript-HTML5-Parser/master/htmlparser.js:217:14)
    at String.replace (native)
    at HTMLParser.HTMLParser (https://cdn.rawgit.com/blowsie/Pure-JavaScript-HTML5-Parser/master/htmlparser.js:147:16)
    at html2json (http://localhost:3000/html2json.js:27:5)
    at http://localhost:3000/init.js:43:17
    at http://localhost:3000/js/tinymce/tinymce.min.js:10:19381
    at http://localhost:3000/js/tinymce/tinymce.min.js:10:18445

what my init,js do is just getContent from tinymce and just call html2json.

is this a known issue?

Thanks

commented

@wongmunchoong could you show me the html ?

You mean the value i pass into the html2json?
just
<hr />

or if my js code,

     var rawContent = tinymce.activeEditor.getContent({format : 'raw'});
     var json = html2json(rawContent );
     console.log(json);
     document.getElementById("test1").innerText = JSON.stringify(json, null, 4);

the rawContent contain <hr />

commented

thanks, fixed and publish v1.0.1

Wow, that was fast..
Thanks, works like a charm..