Documentation
¶
Overview ¶
Package jid provides JaWS element identifiers and helpers for writing them into HTML.
Index ¶
Constants ¶
const Invalid = Jid(-1)
Invalid is the canonical invalid Jid returned by the parsers when text does not contain a valid Jid.
Invalid is exactly Jid(-1); the parsers never return any other negative value. Jid.IsValid accepts the broader range j >= 0, so any other negative Jid is reported invalid by IsValid but is not equal to Invalid.
const Prefix = "Jid."
Prefix prefixes HTML IDs based on Jid values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Jid ¶
type Jid int64
Jid is the basis for the HTML id attribute for a UI element within an active request.
It is request-scoped, meaning Jid(1) in one request is not the same element as Jid(1) in another request.
func ParseInt ¶
ParseInt parses a Jid integer and returns it as a Jid.
Returns Invalid if s is not a valid Jid integer or an error occurs.
func ParseString ¶
ParseString parses an unquoted Jid string, such as `Jid.2`, and returns the corresponding value.
An empty string parses to Jid(0), the whole-request id. Returns Invalid if s is non-empty and not a valid Jid string.
func (Jid) AppendInt ¶
AppendInt appends the text format of the Jid's numerical value.
The value is appended only for positive Jids; Jid(0) (the whole-request id) and negative/invalid Jids append nothing.
func (Jid) AppendQuote ¶
AppendQuote appends the string format of the Jid surrounded by double quotes.
func (Jid) AppendStartTagAttr ¶
AppendStartTagAttr appends `<startTag` followed by the quoted Jid as an HTML id attribute when jid is positive (Jid(0) and negative/invalid Jids append only the start tag, matching Jid.AppendInt).
startTag must be a trusted, syntactically valid HTML tag name: it is written verbatim with no escaping or validation and MUST NOT be derived from untrusted user data, or it becomes an HTML-injection primitive. The numeric Jid itself is always safe.