Documentation

Overview

    Package atom provides integer codes (also known as atoms) for a fixed set of frequently occurring HTML strings: tag names and attribute keys such as "p" and "id".

    Sharing an atom's name between all elements with the same tag can result in fewer string allocations when tokenizing and parsing HTML. Integer comparisons are also generally faster than string comparisons.

    The value of an atom's particular code is not guaranteed to stay the same between versions of this package. Neither is any ordering guaranteed: whether atom.H1 < atom.H2 may also change. The codes are not guaranteed to be dense. The only guarantees are that e.g. looking up "div" will yield atom.Div, calling atom.Div.String will return "div", and atom.Div != 0.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func String

    func String(s []byte) string

      String returns a string whose contents are equal to s. In that sense, it is equivalent to string(s) but may be more efficient.

      Types

      type Atom

      type Atom uint32

        Atom is an integer code for a string. The zero value maps to "".

        const (
        	A                         Atom = 0x1
        	Abbr                      Atom = 0x4
        	Accept                    Atom = 0x1a06
        	AcceptCharset             Atom = 0x1a0e
        	Accesskey                 Atom = 0x2c09
        	Acronym                   Atom = 0xaa07
        	Action                    Atom = 0x27206
        	Address                   Atom = 0x6f307
        	Align                     Atom = 0xb105
        	Allowfullscreen           Atom = 0x2080f
        	Allowpaymentrequest       Atom = 0xc113
        	Allowusermedia            Atom = 0xdd0e
        	Alt                       Atom = 0xf303
        	Annotation                Atom = 0x1c90a
        	AnnotationXml             Atom = 0x1c90e
        	Applet                    Atom = 0x31906
        	Area                      Atom = 0x35604
        	Article                   Atom = 0x3fc07
        	As                        Atom = 0x3c02
        	Aside                     Atom = 0x10705
        	Async                     Atom = 0xff05
        	Audio                     Atom = 0x11505
        	Autocomplete              Atom = 0x2780c
        	Autofocus                 Atom = 0x12109
        	Autoplay                  Atom = 0x13c08
        	B                         Atom = 0x101
        	Base                      Atom = 0x3b04
        	Basefont                  Atom = 0x3b08
        	Bdi                       Atom = 0xba03
        	Bdo                       Atom = 0x14b03
        	Bgsound                   Atom = 0x15e07
        	Big                       Atom = 0x17003
        	Blink                     Atom = 0x17305
        	Blockquote                Atom = 0x1870a
        	Body                      Atom = 0x2804
        	Br                        Atom = 0x202
        	Button                    Atom = 0x19106
        	Canvas                    Atom = 0x10306
        	Caption                   Atom = 0x23107
        	Center                    Atom = 0x22006
        	Challenge                 Atom = 0x29b09
        	Charset                   Atom = 0x2107
        	Checked                   Atom = 0x47907
        	Cite                      Atom = 0x19c04
        	Class                     Atom = 0x56405
        	Code                      Atom = 0x5c504
        	Col                       Atom = 0x1ab03
        	Colgroup                  Atom = 0x1ab08
        	Color                     Atom = 0x1bf05
        	Cols                      Atom = 0x1c404
        	Colspan                   Atom = 0x1c407
        	Command                   Atom = 0x1d707
        	Content                   Atom = 0x58b07
        	Contenteditable           Atom = 0x58b0f
        	Contextmenu               Atom = 0x3800b
        	Controls                  Atom = 0x1de08
        	Coords                    Atom = 0x1ea06
        	Crossorigin               Atom = 0x1fb0b
        	Data                      Atom = 0x4a504
        	Datalist                  Atom = 0x4a508
        	Datetime                  Atom = 0x2b808
        	Dd                        Atom = 0x2d702
        	Default                   Atom = 0x10a07
        	Defer                     Atom = 0x5c705
        	Del                       Atom = 0x45203
        	Desc                      Atom = 0x56104
        	Details                   Atom = 0x7207
        	Dfn                       Atom = 0x8703
        	Dialog                    Atom = 0xbb06
        	Dir                       Atom = 0x9303
        	Dirname                   Atom = 0x9307
        	Disabled                  Atom = 0x16408
        	Div                       Atom = 0x16b03
        	Dl                        Atom = 0x5e602
        	Download                  Atom = 0x46308
        	Draggable                 Atom = 0x17a09
        	Dropzone                  Atom = 0x40508
        	Dt                        Atom = 0x64b02
        	Em                        Atom = 0x6e02
        	Embed                     Atom = 0x6e05
        	Enctype                   Atom = 0x28d07
        	Face                      Atom = 0x21e04
        	Fieldset                  Atom = 0x22608
        	Figcaption                Atom = 0x22e0a
        	Figure                    Atom = 0x24806
        	Font                      Atom = 0x3f04
        	Footer                    Atom = 0xf606
        	For                       Atom = 0x25403
        	ForeignObject             Atom = 0x2540d
        	Foreignobject             Atom = 0x2610d
        	Form                      Atom = 0x26e04
        	Formaction                Atom = 0x26e0a
        	Formenctype               Atom = 0x2890b
        	Formmethod                Atom = 0x2a40a
        	Formnovalidate            Atom = 0x2ae0e
        	Formtarget                Atom = 0x2c00a
        	Frame                     Atom = 0x8b05
        	Frameset                  Atom = 0x8b08
        	H1                        Atom = 0x15c02
        	H2                        Atom = 0x2de02
        	H3                        Atom = 0x30d02
        	H4                        Atom = 0x34502
        	H5                        Atom = 0x34f02
        	H6                        Atom = 0x64d02
        	Head                      Atom = 0x33104
        	Header                    Atom = 0x33106
        	Headers                   Atom = 0x33107
        	Height                    Atom = 0x5206
        	Hgroup                    Atom = 0x2ca06
        	Hidden                    Atom = 0x2d506
        	High                      Atom = 0x2db04
        	Hr                        Atom = 0x15702
        	Href                      Atom = 0x2e004
        	Hreflang                  Atom = 0x2e008
        	Html                      Atom = 0x5604
        	HttpEquiv                 Atom = 0x2e80a
        	I                         Atom = 0x601
        	Icon                      Atom = 0x58a04
        	Id                        Atom = 0x10902
        	Iframe                    Atom = 0x2fc06
        	Image                     Atom = 0x30205
        	Img                       Atom = 0x30703
        	Input                     Atom = 0x44b05
        	Inputmode                 Atom = 0x44b09
        	Ins                       Atom = 0x20403
        	Integrity                 Atom = 0x23f09
        	Is                        Atom = 0x16502
        	Isindex                   Atom = 0x30f07
        	Ismap                     Atom = 0x31605
        	Itemid                    Atom = 0x38b06
        	Itemprop                  Atom = 0x19d08
        	Itemref                   Atom = 0x3cd07
        	Itemscope                 Atom = 0x67109
        	Itemtype                  Atom = 0x31f08
        	Kbd                       Atom = 0xb903
        	Keygen                    Atom = 0x3206
        	Keytype                   Atom = 0xd607
        	Kind                      Atom = 0x17704
        	Label                     Atom = 0x5905
        	Lang                      Atom = 0x2e404
        	Legend                    Atom = 0x18106
        	Li                        Atom = 0xb202
        	Link                      Atom = 0x17404
        	List                      Atom = 0x4a904
        	Listing                   Atom = 0x4a907
        	Loop                      Atom = 0x5d04
        	Low                       Atom = 0xc303
        	Main                      Atom = 0x1004
        	Malignmark                Atom = 0xb00a
        	Manifest                  Atom = 0x6d708
        	Map                       Atom = 0x31803
        	Mark                      Atom = 0xb604
        	Marquee                   Atom = 0x32707
        	Math                      Atom = 0x32e04
        	Max                       Atom = 0x33d03
        	Maxlength                 Atom = 0x33d09
        	Media                     Atom = 0xe605
        	Mediagroup                Atom = 0xe60a
        	Menu                      Atom = 0x38704
        	Menuitem                  Atom = 0x38708
        	Meta                      Atom = 0x4b804
        	Meter                     Atom = 0x9805
        	Method                    Atom = 0x2a806
        	Mglyph                    Atom = 0x30806
        	Mi                        Atom = 0x34702
        	Min                       Atom = 0x34703
        	Minlength                 Atom = 0x34709
        	Mn                        Atom = 0x2b102
        	Mo                        Atom = 0xa402
        	Ms                        Atom = 0x67402
        	Mtext                     Atom = 0x35105
        	Multiple                  Atom = 0x35f08
        	Muted                     Atom = 0x36705
        	Name                      Atom = 0x9604
        	Nav                       Atom = 0x1303
        	Nobr                      Atom = 0x3704
        	Noembed                   Atom = 0x6c07
        	Noframes                  Atom = 0x8908
        	Nomodule                  Atom = 0xa208
        	Nonce                     Atom = 0x1a605
        	Noscript                  Atom = 0x21608
        	Novalidate                Atom = 0x2b20a
        	Object                    Atom = 0x26806
        	Ol                        Atom = 0x13702
        	Onabort                   Atom = 0x19507
        	Onafterprint              Atom = 0x2360c
        	Onautocomplete            Atom = 0x2760e
        	Onautocompleteerror       Atom = 0x27613
        	Onauxclick                Atom = 0x61f0a
        	Onbeforeprint             Atom = 0x69e0d
        	Onbeforeunload            Atom = 0x6e70e
        	Onblur                    Atom = 0x56d06
        	Oncancel                  Atom = 0x11908
        	Oncanplay                 Atom = 0x14d09
        	Oncanplaythrough          Atom = 0x14d10
        	Onchange                  Atom = 0x41b08
        	Onclick                   Atom = 0x2f507
        	Onclose                   Atom = 0x36c07
        	Oncontextmenu             Atom = 0x37e0d
        	Oncopy                    Atom = 0x39106
        	Oncuechange               Atom = 0x3970b
        	Oncut                     Atom = 0x3a205
        	Ondblclick                Atom = 0x3a70a
        	Ondrag                    Atom = 0x3b106
        	Ondragend                 Atom = 0x3b109
        	Ondragenter               Atom = 0x3ba0b
        	Ondragexit                Atom = 0x3c50a
        	Ondragleave               Atom = 0x3df0b
        	Ondragover                Atom = 0x3ea0a
        	Ondragstart               Atom = 0x3f40b
        	Ondrop                    Atom = 0x40306
        	Ondurationchange          Atom = 0x41310
        	Onemptied                 Atom = 0x40a09
        	Onended                   Atom = 0x42307
        	Onerror                   Atom = 0x42a07
        	Onfocus                   Atom = 0x43107
        	Onhashchange              Atom = 0x43d0c
        	Oninput                   Atom = 0x44907
        	Oninvalid                 Atom = 0x45509
        	Onkeydown                 Atom = 0x45e09
        	Onkeypress                Atom = 0x46b0a
        	Onkeyup                   Atom = 0x48007
        	Onlanguagechange          Atom = 0x48d10
        	Onload                    Atom = 0x49d06
        	Onloadeddata              Atom = 0x49d0c
        	Onloadedmetadata          Atom = 0x4b010
        	Onloadend                 Atom = 0x4c609
        	Onloadstart               Atom = 0x4cf0b
        	Onmessage                 Atom = 0x4da09
        	Onmessageerror            Atom = 0x4da0e
        	Onmousedown               Atom = 0x4e80b
        	Onmouseenter              Atom = 0x4f30c
        	Onmouseleave              Atom = 0x4ff0c
        	Onmousemove               Atom = 0x50b0b
        	Onmouseout                Atom = 0x5160a
        	Onmouseover               Atom = 0x5230b
        	Onmouseup                 Atom = 0x52e09
        	Onmousewheel              Atom = 0x53c0c
        	Onoffline                 Atom = 0x54809
        	Ononline                  Atom = 0x55108
        	Onpagehide                Atom = 0x5590a
        	Onpageshow                Atom = 0x5730a
        	Onpaste                   Atom = 0x57f07
        	Onpause                   Atom = 0x59a07
        	Onplay                    Atom = 0x5a406
        	Onplaying                 Atom = 0x5a409
        	Onpopstate                Atom = 0x5ad0a
        	Onprogress                Atom = 0x5b70a
        	Onratechange              Atom = 0x5cc0c
        	Onrejectionhandled        Atom = 0x5d812
        	Onreset                   Atom = 0x5ea07
        	Onresize                  Atom = 0x5f108
        	Onscroll                  Atom = 0x60008
        	Onsecuritypolicyviolation Atom = 0x60819
        	Onseeked                  Atom = 0x62908
        	Onseeking                 Atom = 0x63109
        	Onselect                  Atom = 0x63a08
        	Onshow                    Atom = 0x64406
        	Onsort                    Atom = 0x64f06
        	Onstalled                 Atom = 0x65909
        	Onstorage                 Atom = 0x66209
        	Onsubmit                  Atom = 0x66b08
        	Onsuspend                 Atom = 0x67b09
        	Ontimeupdate              Atom = 0x400c
        	Ontoggle                  Atom = 0x68408
        	Onunhandledrejection      Atom = 0x68c14
        	Onunload                  Atom = 0x6ab08
        	Onvolumechange            Atom = 0x6b30e
        	Onwaiting                 Atom = 0x6c109
        	Onwheel                   Atom = 0x6ca07
        	Open                      Atom = 0x1a304
        	Optgroup                  Atom = 0x5f08
        	Optimum                   Atom = 0x6d107
        	Option                    Atom = 0x6e306
        	Output                    Atom = 0x51d06
        	P                         Atom = 0xc01
        	Param                     Atom = 0xc05
        	Pattern                   Atom = 0x6607
        	Picture                   Atom = 0x7b07
        	Ping                      Atom = 0xef04
        	Placeholder               Atom = 0x1310b
        	Plaintext                 Atom = 0x1b209
        	Playsinline               Atom = 0x1400b
        	Poster                    Atom = 0x2cf06
        	Pre                       Atom = 0x47003
        	Preload                   Atom = 0x48607
        	Progress                  Atom = 0x5b908
        	Prompt                    Atom = 0x53606
        	Public                    Atom = 0x58606
        	Q                         Atom = 0xcf01
        	Radiogroup                Atom = 0x30a
        	Rb                        Atom = 0x3a02
        	Readonly                  Atom = 0x35708
        	Referrerpolicy            Atom = 0x3d10e
        	Rel                       Atom = 0x48703
        	Required                  Atom = 0x24c08
        	Reversed                  Atom = 0x8008
        	Rows                      Atom = 0x9c04
        	Rowspan                   Atom = 0x9c07
        	Rp                        Atom = 0x23c02
        	Rt                        Atom = 0x19a02
        	Rtc                       Atom = 0x19a03
        	Ruby                      Atom = 0xfb04
        	S                         Atom = 0x2501
        	Samp                      Atom = 0x7804
        	Sandbox                   Atom = 0x12907
        	Scope                     Atom = 0x67505
        	Scoped                    Atom = 0x67506
        	Script                    Atom = 0x21806
        	Seamless                  Atom = 0x37108
        	Section                   Atom = 0x56807
        	Select                    Atom = 0x63c06
        	Selected                  Atom = 0x63c08
        	Shape                     Atom = 0x1e505
        	Size                      Atom = 0x5f504
        	Sizes                     Atom = 0x5f505
        	Slot                      Atom = 0x1ef04
        	Small                     Atom = 0x20605
        	Sortable                  Atom = 0x65108
        	Sorted                    Atom = 0x33706
        	Source                    Atom = 0x37806
        	Spacer                    Atom = 0x43706
        	Span                      Atom = 0x9f04
        	Spellcheck                Atom = 0x4740a
        	Src                       Atom = 0x5c003
        	Srcdoc                    Atom = 0x5c006
        	Srclang                   Atom = 0x5f907
        	Srcset                    Atom = 0x6f906
        	Start                     Atom = 0x3fa05
        	Step                      Atom = 0x58304
        	Strike                    Atom = 0xd206
        	Strong                    Atom = 0x6dd06
        	Style                     Atom = 0x6ff05
        	Sub                       Atom = 0x66d03
        	Summary                   Atom = 0x70407
        	Sup                       Atom = 0x70b03
        	Svg                       Atom = 0x70e03
        	System                    Atom = 0x71106
        	Tabindex                  Atom = 0x4be08
        	Table                     Atom = 0x59505
        	Target                    Atom = 0x2c406
        	Tbody                     Atom = 0x2705
        	Td                        Atom = 0x9202
        	Template                  Atom = 0x71408
        	Textarea                  Atom = 0x35208
        	Tfoot                     Atom = 0xf505
        	Th                        Atom = 0x15602
        	Thead                     Atom = 0x33005
        	Time                      Atom = 0x4204
        	Title                     Atom = 0x11005
        	Tr                        Atom = 0xcc02
        	Track                     Atom = 0x1ba05
        	Translate                 Atom = 0x1f209
        	Tt                        Atom = 0x6802
        	Type                      Atom = 0xd904
        	Typemustmatch             Atom = 0x2900d
        	U                         Atom = 0xb01
        	Ul                        Atom = 0xa702
        	Updateviacache            Atom = 0x460e
        	Usemap                    Atom = 0x59e06
        	Value                     Atom = 0x1505
        	Var                       Atom = 0x16d03
        	Video                     Atom = 0x2f105
        	Wbr                       Atom = 0x57c03
        	Width                     Atom = 0x64905
        	Workertype                Atom = 0x71c0a
        	Wrap                      Atom = 0x72604
        	Xmp                       Atom = 0x12f03
        )

        func Lookup

        func Lookup(s []byte) Atom

          Lookup returns the atom whose name is s. It returns zero if there is no such atom. The lookup is case sensitive.

          func (Atom) String

          func (a Atom) String() string

            String returns the atom's name.

            Source Files