2 HtmlElement
The-Mighty-Cat edited this page 2025-02-12 23:10:58 +01:00
namespace Crafter::CppDOM {
    export class HtmlElement {
        public:
        void* const ptr;
        inline HtmlElement(const char* id, std::size_t idLenght);
        inline HtmlElement(const std::string& id); }
        inline void SetInnerHTML(const char* html, std::size_t htmlLenght); }
        inline void SetInnerHTML(const std::string& html);
        inline ~HtmlElement();
    };
}

The HtmlElement is an abstraction layer of HTML elements and bindings related to them.

It is generally recommended to use this over raw bindings as this enforces memory safety with the destructor and is easier to use.

It is constructed via the GetElementById binding and the resulting JS pointer is stored in the ptr member variable.