Skip to content

6.0.0

Latest

Choose a tag to compare

@jcbrand jcbrand released this 05 Nov 08:47
· 1 commit to master since this release
a0d6c64

Breaking changes

  • Markup interpolated into an stx template must be well-formed on its own. A fragment from
    Stanza.unsafeXML() or a Builder is now parsed separately and confined to the element it lands
    in, so it can no longer open or close the template's own elements. A value at document level can
    still span the whole stanza.
  • toString() on an stx stanza returns exactly what connection.send() sends, and throws
    whatever building the stanza throws. This means stx`to="${to}"` (used for conditional
    attributes) now throws missing root element. Use
    unsafeXML(`to="${Strophe.xmlescape(to)}"`) instead.
  • Strophe.stripWhitespace() exempts only the XHTML-IM <body> (XEP-0071), not every element
    named body.
  • Strophe.xmlTextNode(), Strophe.xmlElement(), Builder.t() and Builder.attrs() throw on
    characters XML cannot represent
    , such as control characters and lone surrogates. Previously these
    reached the server, which closed the stream. Line endings are normalised to LF, and tabs and line
    breaks in attribute values are serialized as character references.

Fixes

  • #886: TypeScript types resolve under "moduleResolution": "node16" and "nodenext", and Node
    consumers get the Node entry's types. The published types are ESM-only, so TypeScript projects
    compiling to CommonJS need nodenext with TypeScript 5.8 or later.
  • stx keeps whitespace that comes from interpolated values, in text and in attributes, and strips
    only the template's own indentation. ${x} and ${unsafeXML(x)} in the same position lay out alike.
  • Markup spliced in with unsafeXML() or a Builder keeps its whitespace, except at document level.
  • Strophe.stripWhitespace() honours xml:space="preserve" and xml:space="default".
  • Comments and processing instructions are dropped from the tree an stx template builds, since an
    XMPP stream cannot carry them. A value interpolated into one throws instead of silently vanishing.
  • A value that lands inside a comment or CDATA section opened by interpolated markup now throws,
    instead of being dropped or escaped twice.
  • Strophe.ElementType gained PROCESSING_INSTRUCTION (7) and COMMENT (8).
  • Strophe.VERSION reports the real version again. It had said 4.0.0 since that release.