I have this markup
<html>
... some HTML ...
And I need to wrap it with an element like this:
<html>
<div class="user-content">
... some HTML ...
</div>
The problem, is ... some HTML ...
can be lots of different things from raw text to complicated markup.
<div>
If I use a <div>
, then it adds a block-level break. Meaning if I had
Paul is cool
now I have
<div class="user-content">
Paul is cool
</div>
which forces a line break.
<span>
If I use a <span>
then weird things start happening when I have a <span>
contain a <div>
. For example, the width of the span is shown as 0px which makes javascript not too happy with that node.
Is there a better tag I can use?
Some context
It's a long story. I need the node to exist in the HTML since I'm running untrusted javascript and I don't want the javascript to be able to walk inside that node. To do that, we've sandboxed all the DOM functions, and at each DOM call, we'll check if we're operating on a "user-content" node and not allow access if we are walking there or to any of its children.