Interface TextChunk

All Superinterfaces:
org.teavm.jso.JSObject

public interface TextChunk extends org.teavm.jso.JSObject
A piece of text. The parser does not buffer, so one text node can arrive as several chunks; the last has isLastInTextNode() set and may be empty.
Since:
1.0.3
  • Method Details

    • getText

      String getText()
      Returns the text of this chunk.
      Returns:
      the text of this chunk
    • isLastInTextNode

      boolean isLastInTextNode()
      Returns whether this is the last chunk of its text node.
      Returns:
      whether this is the last chunk of its text node
    • isRemoved

      boolean isRemoved()
      Returns whether an earlier handler already removed or replaced this chunk.
      Returns:
      whether an earlier handler already removed or replaced this chunk
    • before

      TextChunk before(String content)
      Inserts text before the chunk.
      Parameters:
      content - the text, escaped
      Returns:
      this chunk
    • before

      TextChunk before(String content, ContentOptions options)
      Inserts content before the chunk.
      Parameters:
      content - the content
      options - how to read it
      Returns:
      this chunk
    • after

      TextChunk after(String content)
      Inserts text after the chunk.
      Parameters:
      content - the text, escaped
      Returns:
      this chunk
    • after

      TextChunk after(String content, ContentOptions options)
      Inserts content after the chunk.
      Parameters:
      content - the content
      options - how to read it
      Returns:
      this chunk
    • replace

      TextChunk replace(String content)
      Replaces the chunk by text.
      Parameters:
      content - the text, escaped
      Returns:
      this chunk
    • replace

      TextChunk replace(String content, ContentOptions options)
      Replaces the chunk by other content.
      Parameters:
      content - the content
      options - how to read it
      Returns:
      this chunk
    • remove

      TextChunk remove()
      Removes the chunk.
      Returns:
      this chunk