You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
#ifndef CPPJS_ELEMENT_H
|
|
#define CPPJS_ELEMENT_H
|
|
|
|
|
|
class Element {
|
|
private:
|
|
std::string _selector_ref = "";
|
|
int _selector_nth_elem = 0;
|
|
void _identify_and_rebase();
|
|
|
|
public:
|
|
Element(std::string selector, int nth_elem = 0);
|
|
Element(Element& parent, std::string innerHTML, std::string selector, int nth_elem = 0);
|
|
|
|
std::string getInnerHTML();
|
|
std::string getInnerText();
|
|
std::string getID();
|
|
std::string getUUID();
|
|
std::string getClassRaw();
|
|
std::vector<std::string> getClasses();
|
|
bool hasClass(std::string cls);
|
|
std::string getAttribute(std::string attr);
|
|
std::string getData(std::string key);
|
|
|
|
void setInnerHTML(std::string html);
|
|
void setInnerText(std::string text);
|
|
void setID(std::string id);
|
|
void setClassRaw(std::string cls);
|
|
void addClass(std::string cls);
|
|
void removeClass(std::string cls);
|
|
void toggleClass(std::string cls);
|
|
void setAttribute(std::string attr, std::string value);
|
|
void setData(std::string key, std::string value);
|
|
void append(std::string html);
|
|
|
|
// void addEventListener(std::string dom_event, void(*func)());
|
|
|
|
void rebase(std::string query_selector, int nth_elem = 0);
|
|
|
|
Element* querySelectChild(std::string selector, int nth_elem = 0);
|
|
};
|
|
|
|
#include "Element.cpp"
|
|
|
|
|
|
#endif //CPPJS_ELEMENT_H
|