Re: Text selector [was Re: breaking overflow]

On Sun, Jan 3, 2010 at 7:42 PM, Brad Kemper <brad.kemper@gmail.com> wrote:
> On Jan 3, 2010, at 1:14 PM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:
>> What if "bar" is split over two adjacent textnodes in the DOM?
>
> Forgive my ignorance, but when does that happen? Can they be treated as one?

Elements in the DOM contain an array of their children, where
"children" are element nodes, text nodes, and a few others.  Frex,
"<p>foo <i>bar</i> baz</p>" contains at least three nodes - a text
node containing "foo ", a i element node, and a text node containing "
bar".  It's possible, though, for those text nodes to be split into
multiple pieces - the first one could be a text node containing "f"
and another containing "oo ".

I'm not sure how difficult it would be to match across text nodes.  I
feel it's pretty necessary, though - runs of adjacent text nodes are
normally invisible to the user and author, and having things not match
at seemingly random times because, say, a hiccup in the network forced
the parser to pause and end the text node it was constructing, would
be a very bad thing.

~TJ

Received on Monday, 4 January 2010 02:29:07 UTC