Returning HTML contents from a container

text() returns a stripped version of the any contents of a container i queried, such as a div. Great. However I want to keep the HTML in the content, such as links / images etc.

html() allows returning of html content - great! - but it also seems to return the container too, such as a div.

My HTML looks like:

<div id="post_message_3865820">
This is <strong>the</strong> official
</div> 

$post is set earlier to a qp() object.

Calling $body = $post->find('#post_message_3865820')->text(); returns:

This is the official

Calling $body = $post->find('#post_message_3865820')->html(); returns:

<div id="post_message_3865820">&#13;
This is <strong>the</strong> official&#13;
</div>

How can I get the HTML markup without the container included? Should ->html() be returning the container markup in the first place?

»

QueryPath 2.0 now has a method for this!

QueryPath 2.0 has innerHTML() and innerXML() just for this purpose!

Thanks for the suggestion.