1 module libwasm.bindings.DocumentFragment; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.Element; 7 import libwasm.bindings.HTMLCollection; 8 import libwasm.bindings.LegacyQueryInterface; 9 import libwasm.bindings.Node; 10 import libwasm.bindings.NodeList; 11 import libwasm.bindings.ParentNode; 12 13 @safe: 14 nothrow: 15 16 struct DocumentFragment { 17 nothrow: 18 libwasm.bindings.Node.Node _parent; 19 alias _parent this; 20 this(Handle h) { 21 _parent = .Node(h); 22 } 23 auto getElementById()(string elementId) { 24 return recastOpt!(Element)(Object_Call_string__OptionalHandle(this._parent, "getElementById", elementId)); 25 } 26 auto querySelector()(string selectors) { 27 return recastOpt!(Element)(Object_Call_string__OptionalHandle(this._parent, "querySelector", selectors)); 28 } 29 auto querySelectorAll()(string selectors) { 30 return NodeList(Object_Call_string__Handle(this._parent, "querySelectorAll", selectors)); 31 } 32 auto children()() { 33 return HTMLCollection(Object_Getter__Handle(this._parent, "children")); 34 } 35 auto firstElementChild()() { 36 return recastOpt!(Element)(Object_Getter__OptionalHandle(this._parent, "firstElementChild")); 37 } 38 auto lastElementChild()() { 39 return recastOpt!(Element)(Object_Getter__OptionalHandle(this._parent, "lastElementChild")); 40 } 41 uint childElementCount()() { 42 return Object_Getter__uint(this._parent, "childElementCount"); 43 } 44 auto getElementsByAttribute()(string name, string value) { 45 return HTMLCollection(Object_Call_string_string__Handle(this._parent, "getElementsByAttribute", name, value)); 46 } 47 auto getElementsByAttributeNS(T0)(scope auto ref Optional!(T0) namespaceURI, string name, string value) if (isTOrPointer!(T0, string)) { 48 return HTMLCollection(Serialize_Object_VarArgCall!Handle(this._parent, "getElementsByAttributeNS", "Optional!(string);string;string", tuple(!namespaceURI.empty, namespaceURI.front, name, value))); 49 } 50 void prepend()(scope ref SumType!(Node, string) nodes) { 51 Serialize_Object_VarArgCall!void(this._parent, "prepend", "SumType!(Handle,string)", tuple(libwasm.sumtype.match!(((ref nodes.Types[0] v) => 0),((string v) => 1))(nodes),tuple(libwasm.sumtype.match!(((ref nodes.Types[0] v) => cast(Handle)v.handle),((string v) => Handle.init))(nodes),libwasm.sumtype.match!(((ref nodes.Types[0] v) => string.init),((string v) => v))(nodes)))); 52 } 53 void append()(scope ref SumType!(Node, string) nodes) { 54 Serialize_Object_VarArgCall!void(this._parent, "append", "SumType!(Handle,string)", tuple(libwasm.sumtype.match!(((ref nodes.Types[0] v) => 0),((string v) => 1))(nodes),tuple(libwasm.sumtype.match!(((ref nodes.Types[0] v) => cast(Handle)v.handle),((string v) => Handle.init))(nodes),libwasm.sumtype.match!(((ref nodes.Types[0] v) => string.init),((string v) => v))(nodes)))); 55 } 56 auto QueryInterface(T0)(scope auto ref T0 iid) { 57 // Any 58 Handle _handle_iid = getOrCreateHandle(iid); 59 auto result = nsISupports(Object_Call_Handle__Handle(this._parent, "QueryInterface", _handle_iid)); 60 dropHandle!(T0)(_handle_iid); 61 return result; 62 } 63 } 64 65