kostya / lexbor

Fast HTML5 Parser with CSS selectors. This is successor of myhtml and expected to be faster and use less memory.
MIT License
95 stars 14 forks source link

Can I get inner_html? #4

Closed Dan-Do closed 3 years ago

Dan-Do commented 3 years ago

Right now it has setter inner_html= I want to get inner_html, ex:

<template id="tpl-header"><ul>foo</ul><div>bar</div></template>

inner_html should be <ul>foo</ul><div>bar</div> I am using a work around

node.to_html.sub(node.to_html(false), "").sub("</"+node.tag_name+">", "")

though having a getter should be better.

kostya commented 3 years ago

did you try this? https://github.com/kostya/myhtml/issues/19#issuecomment-605740479, just replace myhtml to lexbor

Dan-Do commented 3 years ago

It works. Thank you.

kostya commented 3 years ago

i added 2 methods, node#inner_html and #node#inner_pretty_html, btw: this example with template not work like in myhtml, i not know is it lexbor bug, or my wrapper.