package atom
import "golang.org/x/net/html/atom"
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 ¶
Functions ¶
func 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 = 0x26506 Address Atom = 0x6f107 Align Atom = 0xb105 Allowfullscreen Atom = 0x3280f Allowpaymentrequest Atom = 0xc113 Allowusermedia Atom = 0xdd0e Alt Atom = 0xf303 Annotation Atom = 0x1c90a AnnotationXml Atom = 0x1c90e Applet Atom = 0x30806 Area Atom = 0x35004 Article Atom = 0x3f607 As Atom = 0x3c02 Aside Atom = 0x10705 Async Atom = 0xff05 Audio Atom = 0x11505 Autocomplete Atom = 0x26b0c 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 = 0x22407 Center Atom = 0x21306 Challenge Atom = 0x28e09 Charset Atom = 0x2107 Checked Atom = 0x5b507 Cite Atom = 0x19c04 Class Atom = 0x55805 Code Atom = 0x5ee04 Col Atom = 0x1ab03 Colgroup Atom = 0x1ab08 Color Atom = 0x1bf05 Cols Atom = 0x1c404 Colspan Atom = 0x1c407 Command Atom = 0x1d707 Content Atom = 0x57b07 Contenteditable Atom = 0x57b0f Atom = 0x37a0b Controls Atom = 0x1de08 Coords Atom = 0x1f006 Crossorigin Atom = 0x1fa0b Data Atom = 0x49904 Datalist Atom = 0x49908 Datetime Atom = 0x2ab08 Dd Atom = 0x2bf02 Default Atom = 0x10a07 Defer Atom = 0x5f005 Del Atom = 0x44c03 Desc Atom = 0x55504 Details Atom = 0x7207 Dfn Atom = 0x8703 Dialog Atom = 0xbb06 Dir Atom = 0x9303 Dirname Atom = 0x9307 Disabled Atom = 0x16408 Div Atom = 0x16b03 Dl Atom = 0x5d602 Download Atom = 0x45d08 Draggable Atom = 0x17a09 Dropzone Atom = 0x3ff08 Dt Atom = 0x64002 Em Atom = 0x6e02 Embed Atom = 0x6e05 Enctype Atom = 0x28007 Face Atom = 0x21104 Fieldset Atom = 0x21908 Figcaption Atom = 0x2210a Figure Atom = 0x23b06 Font Atom = 0x3f04 Atom = 0xf606 For Atom = 0x24703 ForeignObject Atom = 0x2470d Foreignobject Atom = 0x2540d Form Atom = 0x26104 Formaction Atom = 0x2610a Formenctype Atom = 0x27c0b Formmethod Atom = 0x2970a Formnovalidate Atom = 0x2a10e Formtarget Atom = 0x2b30a Frame Atom = 0x8b05 Frameset Atom = 0x8b08 H1 Atom = 0x15c02 H2 Atom = 0x56102 H3 Atom = 0x2cd02 H4 Atom = 0x2fc02 H5 Atom = 0x33f02 H6 Atom = 0x34902 Head Atom = 0x32004 Header Atom = 0x32006 Headers Atom = 0x32007 Height Atom = 0x5206 Hgroup Atom = 0x64206 Hidden Atom = 0x2bd06 High Atom = 0x2ca04 Hr Atom = 0x15702 Href Atom = 0x2cf04 Hreflang Atom = 0x2cf08 Html Atom = 0x5604 HttpEquiv Atom = 0x2d70a I Atom = 0x601 Icon Atom = 0x57a04 Id Atom = 0x10902 Iframe Atom = 0x2eb06 Image Atom = 0x2f105 Img Atom = 0x2f603 Input Atom = 0x44505 Inputmode Atom = 0x44509 Ins Atom = 0x20303 Integrity Atom = 0x23209 Is Atom = 0x16502 Isindex Atom = 0x2fe07 Ismap Atom = 0x30505 Itemid Atom = 0x38506 Itemprop Atom = 0x19d08 Itemref Atom = 0x3c707 Itemscope Atom = 0x66f09 Itemtype Atom = 0x30e08 Kbd Atom = 0xb903 Keygen Atom = 0x3206 Keytype Atom = 0xd607 Kind Atom = 0x17704 Label Atom = 0x5905 Lang Atom = 0x2d304 Legend Atom = 0x18106 Li Atom = 0xb202 Link Atom = 0x17404 List Atom = 0x49d04 Listing Atom = 0x49d07 Loop Atom = 0x5d04 Low Atom = 0xc303 Main Atom = 0x1004 Malignmark Atom = 0xb00a Manifest Atom = 0x6d508 Map Atom = 0x30703 Mark Atom = 0xb604 Marquee Atom = 0x31607 Math Atom = 0x31d04 Max Atom = 0x33703 Maxlength Atom = 0x33709 Media Atom = 0xe605 Mediagroup Atom = 0xe60a Menu Atom = 0x38104 Menuitem Atom = 0x38108 Meta Atom = 0x4ac04 Meter Atom = 0x9805 Method Atom = 0x29b06 Mglyph Atom = 0x2f706 Mi Atom = 0x34102 Min Atom = 0x34103 Minlength Atom = 0x34109 Mn Atom = 0x2a402 Mo Atom = 0xa402 Ms Atom = 0x67202 Mtext Atom = 0x34b05 Multiple Atom = 0x35908 Muted Atom = 0x36105 Name Atom = 0x9604 Atom = 0x1303 Nobr Atom = 0x3704 Noembed Atom = 0x6c07 Noframes Atom = 0x8908 Nomodule Atom = 0xa208 Nonce Atom = 0x1a605 Noscript Atom = 0x2c208 Novalidate Atom = 0x2a50a Object Atom = 0x25b06 Ol Atom = 0x13702 Onabort Atom = 0x19507 Onafterprint Atom = 0x2290c Onautocomplete Atom = 0x2690e Onautocompleteerror Atom = 0x26913 Onauxclick Atom = 0x6140a Onbeforeprint Atom = 0x69c0d Onbeforeunload Atom = 0x6e50e Onblur Atom = 0x1ea06 Oncancel Atom = 0x11908 Oncanplay Atom = 0x14d09 Oncanplaythrough Atom = 0x14d10 Onchange Atom = 0x41508 Onclick Atom = 0x2e407 Onclose Atom = 0x36607 Atom = 0x3780d Oncopy Atom = 0x38b06 Oncuechange Atom = 0x3910b Oncut Atom = 0x39c05 Ondblclick Atom = 0x3a10a Ondrag Atom = 0x3ab06 Ondragend Atom = 0x3ab09 Ondragenter Atom = 0x3b40b Ondragexit Atom = 0x3bf0a Ondragleave Atom = 0x3d90b Ondragover Atom = 0x3e40a Ondragstart Atom = 0x3ee0b Ondrop Atom = 0x3fd06 Ondurationchange Atom = 0x40d10 Onemptied Atom = 0x40409 Onended Atom = 0x41d07 Onerror Atom = 0x42407 Onfocus Atom = 0x42b07 Onhashchange Atom = 0x4370c Oninput Atom = 0x44307 Oninvalid Atom = 0x44f09 Onkeydown Atom = 0x45809 Onkeypress Atom = 0x4650a Onkeyup Atom = 0x47407 Onlanguagechange Atom = 0x48110 Onload Atom = 0x49106 Onloadeddata Atom = 0x4910c Onloadedmetadata Atom = 0x4a410 Onloadend Atom = 0x4ba09 Onloadstart Atom = 0x4c30b Onmessage Atom = 0x4ce09 Onmessageerror Atom = 0x4ce0e Onmousedown Atom = 0x4dc0b Onmouseenter Atom = 0x4e70c Onmouseleave Atom = 0x4f30c Onmousemove Atom = 0x4ff0b Onmouseout Atom = 0x50a0a Onmouseover Atom = 0x5170b Onmouseup Atom = 0x52209 Onmousewheel Atom = 0x5300c Onoffline Atom = 0x53c09 Ononline Atom = 0x54508 Onpagehide Atom = 0x54d0a Onpageshow Atom = 0x5630a Onpaste Atom = 0x56f07 Onpause Atom = 0x58a07 Onplay Atom = 0x59406 Onplaying Atom = 0x59409 Onpopstate Atom = 0x59d0a Onprogress Atom = 0x5a70a Onratechange Atom = 0x5bc0c Onrejectionhandled Atom = 0x5c812 Onreset Atom = 0x5da07 Onresize Atom = 0x5e108 Onscroll Atom = 0x5f508 Onsecuritypolicyviolation Atom = 0x5fd19 Onseeked Atom = 0x61e08 Onseeking Atom = 0x62609 Onselect Atom = 0x62f08 Onshow Atom = 0x63906 Onsort Atom = 0x64d06 Onstalled Atom = 0x65709 Onstorage Atom = 0x66009 Onsubmit Atom = 0x66908 Onsuspend Atom = 0x67909 Ontimeupdate Atom = 0x400c Ontoggle Atom = 0x68208 Onunhandledrejection Atom = 0x68a14 Onunload Atom = 0x6a908 Onvolumechange Atom = 0x6b10e Onwaiting Atom = 0x6bf09 Onwheel Atom = 0x6c807 Open Atom = 0x1a304 Optgroup Atom = 0x5f08 Optimum Atom = 0x6cf07 Option Atom = 0x6e106 Output Atom = 0x51106 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 = 0x64706 Pre Atom = 0x46a03 Preload Atom = 0x47a07 Progress Atom = 0x5a908 Prompt Atom = 0x52a06 Public Atom = 0x57606 Q Atom = 0xcf01 Radiogroup Atom = 0x30a Rb Atom = 0x3a02 Readonly Atom = 0x35108 Referrerpolicy Atom = 0x3cb0e Rel Atom = 0x47b03 Required Atom = 0x23f08 Reversed Atom = 0x8008 Rows Atom = 0x9c04 Rowspan Atom = 0x9c07 Rp Atom = 0x22f02 Rt Atom = 0x19a02 Rtc Atom = 0x19a03 Ruby Atom = 0xfb04 S Atom = 0x2501 Samp Atom = 0x7804 Sandbox Atom = 0x12907 Scope Atom = 0x67305 Scoped Atom = 0x67306 Script Atom = 0x2c406 Seamless Atom = 0x36b08 Search Atom = 0x55c06 Section Atom = 0x1e507 Select Atom = 0x63106 Selected Atom = 0x63108 Shape Atom = 0x1f505 Size Atom = 0x5e504 Sizes Atom = 0x5e505 Slot Atom = 0x20504 Small Atom = 0x32605 Sortable Atom = 0x64f08 Sorted Atom = 0x37206 Source Atom = 0x43106 Spacer Atom = 0x46e06 Span Atom = 0x9f04 Spellcheck Atom = 0x5b00a Src Atom = 0x5e903 Srcdoc Atom = 0x5e906 Srclang Atom = 0x6f707 Srcset Atom = 0x6fe06 Start Atom = 0x3f405 Step Atom = 0x57304 Strike Atom = 0xd206 Strong Atom = 0x6db06 Style Atom = 0x70405 Sub Atom = 0x66b03 Summary Atom = 0x70907 Sup Atom = 0x71003 Svg Atom = 0x71303 System Atom = 0x71606 Tabindex Atom = 0x4b208 Table Atom = 0x58505 Target Atom = 0x2b706 Tbody Atom = 0x2705 Td Atom = 0x9202 Template Atom = 0x71908 Textarea Atom = 0x34c08 Tfoot Atom = 0xf505 Th Atom = 0x15602 Thead Atom = 0x31f05 Time Atom = 0x4204 Title Atom = 0x11005 Tr Atom = 0xcc02 Track Atom = 0x1ba05 Translate Atom = 0x20809 Tt Atom = 0x6802 Type Atom = 0xd904 Typemustmatch Atom = 0x2830d U Atom = 0xb01 Ul Atom = 0xa702 Updateviacache Atom = 0x460e Usemap Atom = 0x58e06 Value Atom = 0x1505 Var Atom = 0x16d03 Video Atom = 0x2e005 Wbr Atom = 0x56c03 Width Atom = 0x63e05 Workertype Atom = 0x7210a Wrap Atom = 0x72b04 Xmp Atom = 0x12f03 )
func Lookup ¶
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 ¶
String returns the atom's name.
Source Files ¶
atom.go table.go
- Version
- v0.38.0
- Published
- Mar 27, 2025
- Platform
- linux/amd64
- Last checked
- 1 hour ago –
Tools for package owners.