Documentation
¶
Overview ¶
Package htmlelements contain code to help generate code for implementing the different subclasses of HTMLElement, in the browser/html package.
This includes - IDL attributes
Index ¶
- Variables
- func CreateGenerator(req HTMLGeneratorReq) (baseGenerator, error)
- func CreateHTMLElementGenerator(req HTMLGeneratorReq) (htmlElementGenerator, error)
- func GenerateDOMTypes() error
- func GenerateHTMLElements() error
- type FileGeneratorSpec
- type HTMLGeneratorReq
- type IDLAttribute
- type IdlInterface
- type IdlInterfaceAttribute
- type IdlInterfaceOperation
- type Receiver
Constants ¶
This section is empty.
Variables ¶
var HTMLAnchorElementSpecs = HTMLGeneratorReq{ InterfaceName: "HTMLAnchorElement", SpecName: "html", GenerateInterface: true, GenerateAttributes: true, }
var URLSpec = HTMLGeneratorReq{ InterfaceName: "URL", SpecName: "url", GenerateInterface: true, }
Functions ¶
func CreateGenerator ¶
func CreateGenerator(req HTMLGeneratorReq) (baseGenerator, error)
func CreateHTMLElementGenerator ¶
func CreateHTMLElementGenerator(req HTMLGeneratorReq) (htmlElementGenerator, error)
CreateHTMLElementGenerator creates a generator for the element with
func GenerateDOMTypes ¶
func GenerateDOMTypes() error
func GenerateHTMLElements ¶
func GenerateHTMLElements() error
Types ¶
type FileGeneratorSpec ¶
func CreateDOMGenerators ¶
func CreateDOMGenerators() ([]FileGeneratorSpec, error)
func CreateHTMLElementGenerators ¶
func CreateHTMLElementGenerators() ([]FileGeneratorSpec, error)
type HTMLGeneratorReq ¶
type HTMLGeneratorReq struct {
InterfaceName string
SpecName string
GenerateStruct bool
GenerateConstructor bool
GenerateInterface bool
GenerateAttributes bool
}
HTMLGeneratorReq specifies what to generate for a specific Web IDL spec. The name of the spec is in the SpecName field, and the interface to generate is in the Interface field. The Generate... fields specify what to generate.
Note: As more needs for customisation arises, so will the Generate... fields also more likely become more complex.
E.g., the URL type is loaded from url.json, and has the interface name URL in the idl, so this is specified by:
HTMLGeneratorReq {
InterfaceName: "URL",
SpecName: "url",
}
type IDLAttribute ¶
func (IDLAttribute) Generate ¶
func (a IDLAttribute) Generate() *jen.Statement
type IdlInterface ¶
type IdlInterface struct {
Name string
Inherits string
Attributes []IdlInterfaceAttribute
Operations []IdlInterfaceOperation
}
func (IdlInterface) Generate ¶
func (i IdlInterface) Generate() *jen.Statement
type IdlInterfaceAttribute ¶
func NewStringAttribute ¶
func NewStringAttribute(name string) IdlInterfaceAttribute