Closed havefive closed 8 years ago
@havefive Can you give a specific example you had that failed? I just ran this through:
<div class="my-content">
<em>
My first webpage
</em>
</div>
And it came out as (I) expected it to:
[
{
"dataType": "tag",
"content": "div",
"attributes": {
"class": {
"dataType": "attribute",
"content": "my-content"
}
},
"children": [
{
"dataType": "tag",
"content": "em",
"children": [
{
"dataType": "text",
"content": "My first webpage"
}
]
}
]
}
]
Thanks,here is a example,we want get the timestamp content
<a class="class-over" href="/shots/2720087-The-Great-Outdoors">
<strong>The Great Outdoors</strong>
<span class="comment">Camping related animation I made for a mobile shopping app! Check out that cheeky bear trying to hot dog it!Made in Cinema 4D with Sketch and Toon!</span>
<em class="timestamp">2016-05-11 12:34</em>
</a>
@havefive 0.2.9 Gives this (in HTMLElement objects) when I feed it in
{
"children": [
{
"dataType": "tag",
"attributes": {
"class": {
"dataType": "attribute",
"content": "class-over"
},
"href": {
"dataType": "attribute",
"content": "/shots/2720087-The-Great-Outdoors"
}
},
"content": "a",
"children": [
{
"dataType": "tag",
"content": "strong",
"children": [
{
"dataType": "text",
"content": "The Great Outdoors"
}
]
},
{
"dataType": "tag",
"attributes": {
"class": {
"dataType": "attribute",
"content": "comment"
}
},
"content": "span",
"children": [
{
"dataType": "text",
"content": "Camping related animation I made for a mobile shopping app! Check out that cheeky bear trying to hot dog it!Made in Cinema 4D with Sketch and Toon!"
}
]
},
{
"dataType": "tag",
"attributes": {
"class": {
"dataType": "attribute",
"content": "timestamp"
}
},
"content": "em",
"children": [
{
"dataType": "text",
"content": "2016-05-11 12:34"
}
]
}
]
}
]
}
Does:
elem.getElementsByTagName("em")[0].children[0].content
Give you what you're looking for, or no?
@Eagerod I see,thanks a lot
Sames like cann't parse em tag content