1

我遇到了这个问题:我使用 TEI 锚元素来描述文本行。为了描述这些行,我在每一行的开头使用了一个元素(它是一个空元素)和一个元素(它也是一个空元素)。

我希望下面的例子有助于描述这种情况。

<p>
   <anchor type="start" n="line1" rend="x1,y1,r1"/> This <b>is</b> text <anchor type="end" n="line1"/>
   <anchor type="start" n="line2" rend="x2,y2,r2"/> This is text <anchor type="end" n="line2"/>
   <anchor type="start" n="line3" rend="x3,y3,r3"/> This is text <anchor type="end" n="line3"/>
</p>

现在我想获取每个文本片段(位于同一n -attirube 的两个锚元素之间),并将其包装在自己的 DIV 中。

对于这个方法,我尝试使用此代码(这是示例代码,所以请不要在语法上钉我):

$( "anchor[type='start']" ).each(function()
    {
        $(this).nextUntil( "anchor[type='end']").each(function()
            {
                $(this).wrap( "<div  n='#' style='doSomething'/>" );
            });
        }
    );

现在,我知道 jquery nextUntil()函数不适用于文本节点。这就是我问的原因。你们知道一些人在这里散步吗?

4

0 回答 0